Java Code Examples for org.apache.logging.log4j.core.config.ConfigurationSource#NULL_SOURCE

The following examples show how to use org.apache.logging.log4j.core.config.ConfigurationSource#NULL_SOURCE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BasicConfigurationFactory.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 2
Source File: BasicConfigurationFactory.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 3
Source File: BasicConfigurationFactory.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 4
Source File: CustomConfiguration.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
public CustomConfiguration(final LoggerContext loggerContext) {
    this(loggerContext, ConfigurationSource.NULL_SOURCE);
}
 
Example 5
Source File: DefaultConfigurationBuilder.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
@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;
}