当前位置: 首页>>代码示例>>Java>>正文


Java SimpleLoggerContextFactory类代码示例

本文整理汇总了Java中org.apache.logging.log4j.simple.SimpleLoggerContextFactory的典型用法代码示例。如果您正苦于以下问题:Java SimpleLoggerContextFactory类的具体用法?Java SimpleLoggerContextFactory怎么用?Java SimpleLoggerContextFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SimpleLoggerContextFactory类属于org.apache.logging.log4j.simple包,在下文中一共展示了SimpleLoggerContextFactory类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getContexts

import org.apache.logging.log4j.simple.SimpleLoggerContextFactory; //导入依赖的package包/类
public static List<? extends LoggerContext> getContexts() {
    LoggerContextFactory factory = org.apache.logging.log4j.LogManager.getFactory();
    if(factory instanceof SimpleLoggerContextFactory) {
        return Collections.singletonList(factory.getContext(null, null, null, true));
    }
    return ((Log4jContextFactory) org.apache.logging.log4j.LogManager.getFactory()).getSelector().getLoggerContexts();
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:8,代码来源:Logging.java

示例2: getContext

import org.apache.logging.log4j.simple.SimpleLoggerContextFactory; //导入依赖的package包/类
/**
 * Returns a LoggerContext.
 *
 * @param currentContext if false the LoggerContext appropriate for the caller of this method is returned. For
 *            example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
 *            returned and if the caller is a class in the container's classpath then a different LoggerContext may
 *            be returned. If true then only a single LoggerContext will be returned.
 * @return a LoggerContext.
 */
public static LoggerContext getContext(final boolean currentContext) {
    // TODO: would it be a terrible idea to try and find the caller ClassLoader here?
    try {
        return factory.getContext(FQCN, null, null, currentContext, null, null);
    } catch (final IllegalStateException ex) {
        LOGGER.warn(ex.getMessage() + " Using SimpleLogger");
        return new SimpleLoggerContextFactory().getContext(FQCN, null, null, currentContext, null, null);
    }
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:19,代码来源:LogManager.java

示例3: beforeClass

import org.apache.logging.log4j.simple.SimpleLoggerContextFactory; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {
    System.setProperty(FACTORY_PROPERTY_NAME, SimpleLoggerContextFactory.class.getName());
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:5,代码来源:TestConfiguratorError.java


注:本文中的org.apache.logging.log4j.simple.SimpleLoggerContextFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。