public void configureLogging ( final LoggingSettings loggingSettings ) { final Logger root = ( Logger ) LoggerFactory . getLogger ( org . slf4j . Logger . ROOT_LOGGER_NAME ) ; final LoggerContext context = root . getLoggerContext ( ) ; // Reset prior configuration context . reset ( ) ; // Propagate level changes to java.util.logging final LevelChangePropagator propagator = new LevelChangePropagator ( ) ; propagator . setContext ( context ) ; propagator . setResetJUL ( true ) ; // Set base threshold for all other loggers. root . setLevel ( loggingSettings . getLevel ( ) ) ; // Loop through explicitly configured loggers and set the levels for ( final Map . Entry < String , Level > entry : loggingSettings . getLoggers ( ) . entrySet ( ) ) { ( ( Logger ) LoggerFactory . getLogger ( entry . getKey ( ) ) ) . setLevel ( entry . getValue ( ) ) ; } if ( loggingSettings . getLogFile ( ) . isEnabled ( ) ) { root . addAppender ( getFileAppender ( loggingSettings . getLogFile ( ) , context ) ) ; } if ( loggingSettings . getConsole ( ) . isEnabled ( ) ) { root . addAppender ( getConsoleAppender ( loggingSettings . getConsole ( ) , context ) ) ; } }
Configure logging .