Search in sources :

Example 1 with AppenderRefComponentBuilder

use of org.apache.logging.log4j.core.config.builder.api.AppenderRefComponentBuilder in project logging-log4j2 by apache.

the class PropertiesConfigurationBuilder method createAppenderRef.

private AppenderRefComponentBuilder createAppenderRef(final String key, final Properties properties) {
    final String ref = (String) properties.remove("ref");
    if (Strings.isEmpty(ref)) {
        throw new ConfigurationException("No ref attribute provided for AppenderRef " + key);
    }
    final AppenderRefComponentBuilder appenderRefBuilder = builder.newAppenderRef(ref);
    final String level = (String) properties.remove("level");
    if (!Strings.isEmpty(level)) {
        appenderRefBuilder.addAttribute("level", level);
    }
    return addFiltersToComponent(appenderRefBuilder, properties);
}
Also used : ConfigurationException(org.apache.logging.log4j.core.config.ConfigurationException) AppenderRefComponentBuilder(org.apache.logging.log4j.core.config.builder.api.AppenderRefComponentBuilder)

Aggregations

ConfigurationException (org.apache.logging.log4j.core.config.ConfigurationException)1 AppenderRefComponentBuilder (org.apache.logging.log4j.core.config.builder.api.AppenderRefComponentBuilder)1