private void addRootLogger (final ConfigurationBuilder <BuiltConfiguration> build) { final RootLoggerComponentBuilder root = build.newRootLogger (this.loggers .getLevel () .getStatus ()); for (final AppenderRefSetting setting : this.loggers.getAppenderRef ()) { final AppenderRefComponentBuilder ref = build.newAppenderRef (setting.getRef ()); addAttributes (ref, setting.getAttributes ()); root.add (ref); } build.add (root); }
public static void intializeLoggers() { ConfigurationBuilder<BuiltConfiguration> builder = ConfigurationBuilderFactory.newConfigurationBuilder(); builder.setConfigurationName("logger"); RootLoggerComponentBuilder rootLogger = builder.newRootLogger(Level.DEBUG); builder.add(rootLogger); Configurator.initialize(builder.build()); }
private void buildRootLogger(final String rootLoggerValue) { if (rootLoggerValue == null) { return; } final String[] rootLoggerParts = rootLoggerValue.split(COMMA_DELIMITED_RE); final String rootLoggerLevel = getLevelString(rootLoggerParts, Level.ERROR.name()); final RootLoggerComponentBuilder loggerBuilder = builder.newRootLogger(rootLoggerLevel); // final String[] sortedAppenderNames = Arrays.copyOfRange(rootLoggerParts, 1, rootLoggerParts.length); Arrays.sort(sortedAppenderNames); for (final String appender : sortedAppenderNames) { loggerBuilder.add(builder.newAppenderRef(appender)); } builder.add(loggerBuilder); }
private RootLoggerComponentBuilder createRootLogger(final Properties properties) { final String level = Strings.trimToNull((String) properties.remove("level")); final String type = (String) properties.remove(CONFIG_TYPE); final String location = (String) properties.remove("includeLocation"); final boolean includeLocation; final RootLoggerComponentBuilder loggerBuilder; if (type != null) { if (type.equalsIgnoreCase("asyncRoot")) { if (location != null) { includeLocation = Boolean.parseBoolean(location); loggerBuilder = builder.newAsyncRootLogger(level, includeLocation); } else { loggerBuilder = builder.newAsyncRootLogger(level); } } else { throw new ConfigurationException("Unknown Logger type for root logger" + type); } } else { if (location != null) { includeLocation = Boolean.parseBoolean(location); loggerBuilder = builder.newRootLogger(level, includeLocation); } else { loggerBuilder = builder.newRootLogger(level); } } addLoggersToComponent(loggerBuilder, properties); return addFiltersToComponent(loggerBuilder, properties); }
@Override public ConfigurationBuilder<T> add(final RootLoggerComponentBuilder builder) { for (final Component c : loggers.getComponents()) { if (c.getPluginType().equals(LoggerConfig.ROOT)) { throw new ConfigurationException("Root Logger was previously defined"); } } return add(loggers, builder); }
@Override public RootLoggerComponentBuilder add(final AppenderRefComponentBuilder builder) { return addComponent(builder); }
@Override public RootLoggerComponentBuilder add(final FilterComponentBuilder builder) { return addComponent(builder); }
@Override public RootLoggerComponentBuilder newAsyncRootLogger() { return new DefaultRootLoggerComponentBuilder(this, "AsyncRoot"); }
@Override public RootLoggerComponentBuilder newAsyncRootLogger(boolean includeLocation) { return new DefaultRootLoggerComponentBuilder(this, null, "AsyncRoot", includeLocation); }
@Override public RootLoggerComponentBuilder newAsyncRootLogger(final Level level) { return new DefaultRootLoggerComponentBuilder(this, level.toString(), "AsyncRoot"); }
@Override public RootLoggerComponentBuilder newAsyncRootLogger(final Level level, final boolean includeLocation) { return new DefaultRootLoggerComponentBuilder(this, level.toString(), "AsyncRoot", includeLocation); }
@Override public RootLoggerComponentBuilder newAsyncRootLogger(final String level) { return new DefaultRootLoggerComponentBuilder(this, level, "AsyncRoot"); }
@Override public RootLoggerComponentBuilder newAsyncRootLogger(final String level, final boolean includeLocation) { return new DefaultRootLoggerComponentBuilder(this, level, "AsyncRoot", includeLocation); }
@Override public RootLoggerComponentBuilder newRootLogger() { return new DefaultRootLoggerComponentBuilder(this, null); }
@Override public RootLoggerComponentBuilder newRootLogger(boolean includeLocation) { return new DefaultRootLoggerComponentBuilder(this, null, includeLocation); }
@Override public RootLoggerComponentBuilder newRootLogger(final Level level) { return new DefaultRootLoggerComponentBuilder(this, level.toString()); }
@Override public RootLoggerComponentBuilder newRootLogger(final Level level, final boolean includeLocation) { return new DefaultRootLoggerComponentBuilder(this, level.toString(), includeLocation); }
@Override public RootLoggerComponentBuilder newRootLogger(final String level) { return new DefaultRootLoggerComponentBuilder(this, level); }
@Override public RootLoggerComponentBuilder newRootLogger(final String level, final boolean includeLocation) { return new DefaultRootLoggerComponentBuilder(this, level, includeLocation); }