Package app.config

Source Code of app.config.LoggingInitializer

package app.config;

import java.util.logging.Handler;
import java.util.logging.LogManager;
import java.util.logging.Logger;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

import org.slf4j.bridge.SLF4JBridgeHandler;

@WebListener
public class LoggingInitializer implements ServletContextListener {

  public void contextInitialized(ServletContextEvent servletContextEvent) {
    Logger rootLogger = LogManager.getLogManager().getLogger("");
    for (Handler handler : rootLogger.getHandlers()) {
      rootLogger.removeHandler(handler);
    }
    SLF4JBridgeHandler.install();
  }

  public void contextDestroyed(ServletContextEvent servletContextEvent) {
  }
}
TOP

Related Classes of app.config.LoggingInitializer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.