org.apache.logging.log4j.core.config.ConfigurationSource#NULL_SOURCE源码实例Demo

下面列出了org.apache.logging.log4j.core.config.ConfigurationSource#NULL_SOURCE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

public BasicConfiguration(final LoggerContext loggerContext) {
    super(loggerContext, ConfigurationSource.NULL_SOURCE);

    final LoggerConfig root = getRootLogger();
    setName("BasicConfiguration");
    final String levelName = System.getProperty(DEFAULT_LEVEL);
    final Level level = (levelName != null && Level.getLevel(levelName) != null) ? Level.getLevel(levelName)
            : Level.DEBUG;
    root.setLevel(level);
}
 
public BasicConfiguration(final LoggerContext loggerContext) {
    super(loggerContext, ConfigurationSource.NULL_SOURCE);

    final LoggerConfig root = getRootLogger();
    setName("BasicConfiguration");
    final String levelName = System.getProperty(DEFAULT_LEVEL);
    final Level level = (levelName != null && Level.getLevel(levelName) != null) ? Level.getLevel(levelName)
            : Level.DEBUG;
    root.setLevel(level);
}
 
public BasicConfiguration() {
    super(null, ConfigurationSource.NULL_SOURCE);

    final LoggerConfig root = getRootLogger();
    final String name = System.getProperty(DEFAULT_LEVEL);
    final Level level = (name != null && Level.getLevel(name) != null) ? Level.getLevel(name) : Level.ERROR;
    root.setLevel(level);
}
 
源代码4 项目: logging-log4j2   文件: CustomConfiguration.java
public CustomConfiguration(final LoggerContext loggerContext) {
    this(loggerContext, ConfigurationSource.NULL_SOURCE);
}
 
@Override
public T build(final boolean initialize) {
    T configuration;
    try {
        if (source == null) {
            source = ConfigurationSource.NULL_SOURCE;
        }
        final Constructor<T> constructor = clazz.getConstructor(LoggerContext.class, ConfigurationSource.class, Component.class);
        configuration = constructor.newInstance(loggerContext, source, root);
        configuration.getRootNode().getAttributes().putAll(root.getAttributes());
        if (name != null) {
            configuration.setName(name);
        }
        if (level != null) {
            configuration.getStatusConfiguration().setStatus(level);
        }
        if (verbosity != null) {
            configuration.getStatusConfiguration().setVerbosity(verbosity);
        }
        if (destination != null) {
            configuration.getStatusConfiguration().setDestination(destination);
        }
        if (packages != null) {
            configuration.setPluginPackages(packages);
        }
        if (shutdownFlag != null) {
            configuration.setShutdownHook(shutdownFlag);
        }
        if (shutdownTimeoutMillis > 0) {
            configuration.setShutdownTimeoutMillis(shutdownTimeoutMillis);
        }
        if (advertiser != null) {
            configuration.createAdvertiser(advertiser, source);
        }
        configuration.setMonitorInterval(monitorInterval);
    } catch (final Exception ex) {
        throw new IllegalArgumentException("Invalid Configuration class specified", ex);
    }
    configuration.getStatusConfiguration().initialize();
    if (initialize) {
        configuration.initialize();
    }
    return configuration;
}