All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.zhengframework.log.logback.LogbackModule Maven / Gradle / Ivy

There is a newer version: 1.8.0
Show newest version
package com.github.zhengframework.log.logback;

import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.jul.LevelChangePropagator;
import com.google.inject.AbstractModule;
import org.slf4j.LoggerFactory;

public class LogbackModule extends AbstractModule {

  public LogbackModule() {
    final Logger root = (Logger) LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
    final LevelChangePropagator propagator = new LevelChangePropagator();
    propagator.setContext(root.getLoggerContext());
    propagator.setResetJUL(true);
    root.getLoggerContext().addListener(propagator);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy