本文整理汇总了Java中org.jboss.logmanager.LogContext.getAttachment方法的典型用法代码示例。如果您正苦于以下问题:Java LogContext.getAttachment方法的具体用法?Java LogContext.getAttachment怎么用?Java LogContext.getAttachment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.logmanager.LogContext
的用法示例。
在下文中一共展示了LogContext.getAttachment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConfigurationPersistence
import org.jboss.logmanager.LogContext; //导入方法依赖的package包/类
/**
* Gets the property configurator. If the {@link ConfigurationPersistence} does not exist a {@code null} is
* returned.
*
* @param logContext the log context used to find the property configurator or to attach it to.
*
* @return the property configurator or {@code null}
*/
public static ConfigurationPersistence getConfigurationPersistence(final LogContext logContext) {
if (logContext == null) return null;
return (ConfigurationPersistence) logContext.getAttachment(CommonAttributes.ROOT_LOGGER_NAME, Configurator.ATTACHMENT_KEY);
}
示例2: isDisabledHandler
import org.jboss.logmanager.LogContext; //导入方法依赖的package包/类
/**
* Checks to see if a handler is disabled
*
* @param handlerName the name of the handler to enable.
*/
static boolean isDisabledHandler(final LogContext logContext, final String handlerName) {
final Map<String, String> disableHandlers = logContext.getAttachment(CommonAttributes.ROOT_LOGGER_NAME, DISABLED_HANDLERS_KEY);
return disableHandlers != null && disableHandlers.containsKey(handlerName);
}