Package ch.qos.logback.classic

Examples of ch.qos.logback.classic.LoggerContext.stop()


    LOG.info("Basic data and configuration has been cleared");   


    //LOG.info("Start to destroy the LogBack MBean Context...");
    LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
      lc.stop();
      LOG.info("Destroyed the LogBack MBean Context...");

  }

  private void loadEnvConfig() {
View Full Code Here


      LoggerContext context = selector.detachLoggerContext(loggerContextName);
      if (context != null) {
        Logger logger = context.getLogger(LoggerContext.ROOT_NAME);
        logger.warn("Stopping logger context " + loggerContextName);
        // when the web-app is destroyed, its logger context should be stopped
        context.stop();
      } else {
        System.out.println("No context named " + loggerContextName + " was found.");
      }
    }
  }
View Full Code Here

    String configFile = args[0];

    if (configFile.endsWith(".xml")) {
      LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
      JoranConfigurator configurator = new JoranConfigurator();
      lc.stop();
      configurator.setContext(lc);
      configurator.doConfigure(configFile);
    }

    Logger logger = LoggerFactory.getLogger(SocketClient2.class);
View Full Code Here

  static void configureViaXML_File() {
    LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
    try {
      JoranConfigurator configurator = new JoranConfigurator();
      configurator.setContext(lc);
      lc.stop();
      URL url = Loader.getResourceBySelfClassLoader("chapters/mdc/simpleMDC.xml");
      configurator.doConfigure(url);
    } catch (JoranException je) {
      StatusPrinter.print(lc);
    }
View Full Code Here

public class LoggerContextListener {
    public void contextDestroyed() {
        LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
        Logger logger = context.getLogger(Logger.ROOT_LOGGER_NAME);
        logger.info("Stopping logger context");
        context.stop();
    }
}
View Full Code Here

          }
        }
      }
    }

    loggerContext.stop();
    chronicle.close();
  }

  @SuppressWarnings("unchecked")
  private static void writeEvent(LoggingEvent evt, Appender appender) {
View Full Code Here

      LoggerContext context = selector.detachLoggerContext(loggerContextName);
      if (context != null) {
        Logger logger = context.getLogger(Logger.ROOT_LOGGER_NAME);
        logger.warn("Stopping logger context " + loggerContextName);
        // when the web-app is destroyed, its logger context should be stopped
        context.stop();
      } else {
        System.out.println("No context named " + loggerContextName + " was found.");
      }
    }
  }
View Full Code Here

      LoggerContext context = selector.detachLoggerContext(loggerContextName);
      if (context != null) {
        Logger logger = context.getLogger(Logger.ROOT_LOGGER_NAME);
        logger.warn("Stopping logger context " + loggerContextName);
        // when the web-app is destroyed, its logger context should be stopped
        context.stop();
      } else {
        System.out.println("No context named " + loggerContextName + " was found.");
      }
    }
  }
View Full Code Here

  }

  @Override
  protected void loadDefaults(String logFile) {
    LoggerContext context = getLoggerContext();
    context.stop();
    context.reset();
    LogbackConfigurator configurator = new LogbackConfigurator(context);
    new DefaultLogbackConfiguration(logFile).apply(configurator);
  }
View Full Code Here

    Assert.notNull(location, "Location must not be null");
    if (StringUtils.hasLength(logFile)) {
      System.setProperty("LOG_FILE", logFile);
    }
    LoggerContext context = getLoggerContext();
    context.stop();
    context.reset();
    try {
      URL url = ResourceUtils.getURL(location);
      new ContextInitializer(context).configureByResource(url);
    }
View Full Code Here

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.