Package ch.qos.logback.classic

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


    try {
      JoranConfigurator configurator = new JoranConfigurator();
      configurator.setContext(context);

      context.reset();

      // placeholder to avoid 'No appenders present' while reconfiguring
      context.getLogger(Logger.ROOT_LOGGER_NAME).addAppender(nopAppender);

      // restore persisted setting so pax-logging can reload
View Full Code Here


        try {
            JoranConfigurator configurator = new JoranConfigurator();
            configurator.setContext(loggerContext);
            // Call context.reset() to clear any previous configuration, e.g. default
            // configuration. For multi-step configuration, omit calling context.reset().
            loggerContext.reset();
            configurator.doConfigure(logfile);
        } catch (JoranException je) {
            // StatusPrinter will handle this
        }
        StatusPrinter.printInCaseOfErrorsOrWarnings(loggerContext);
View Full Code Here

          //URL url = Loader.getResourceBySelfClassLoader(contextConfigFile);
          URL url = Loader.getResource(contextConfigFile, classloader);
          if (url != null) {
            try {
              JoranConfigurator configurator = new JoranConfigurator();
              loggerContext.reset();
              configurator.setContext(loggerContext);
              configurator.doConfigure(url);
            } catch (JoranException e) {
              StatusPrinter.print(loggerContext);
            }
View Full Code Here

    ContextSelector selector = Red5LoggerFactory.getContextSelector();
    LoggerContext context = selector.detachLoggerContext(contextName);
    if (context != null) {
      Logger logger = context.getLogger(Logger.ROOT_LOGGER_NAME);
      logger.debug("Shutting down context {}", contextName);
      context.reset();
    } else {
      System.err.printf("No context named %s was found", contextName);
    }
  }
View Full Code Here

    LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();

    try {
      JoranConfigurator configurator = new JoranConfigurator();
      configurator.setContext(lc);
      lc.reset();
      configurator.doConfigure(args[0]);
    } catch (JoranException je) {
      je.printStackTrace();
    }
   
View Full Code Here

  private void initLogging(Properties props) {
    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    JoranConfigurator jc = new JoranConfigurator();
    jc.setContext(context);
    context.reset();
    InputStream input = Batch.class.getResourceAsStream("/org/sonar/batch/logback.xml");
    System.setProperty("ROOT_LOGGER_LEVEL", isDebug(props) ? DEBUG : "INFO");
    context.putProperty("SQL_LOGGER_LEVEL", getSqlLevel(props));
    context.putProperty("SQL_RESULTS_LOGGER_LEVEL", getSqlResultsLevel(props));
    try {
View Full Code Here

  static void init(String file) throws JoranException {
    LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
    JoranConfigurator jc = new JoranConfigurator();
    jc.setContext(loggerContext);
    loggerContext.reset();
    jc.doConfigure(file);
  }

}
View Full Code Here

  // this test works only if logback-test.xml or logback.xml files are on the classpath.
  // However, this is something we try to avoid in order to simplify the life
  // of users trying to follows the manual and logback-examples from an IDE
  public void autoconfig() {
    LoggerContext iLoggerFactory = (LoggerContext) LoggerFactory.getILoggerFactory();
    iLoggerFactory.reset();
    Appender<ILoggingEvent> appender = root.getAppender("STDOUT");
    assertNotNull(appender);
    assertTrue(appender instanceof ConsoleAppender);
  }
}
View Full Code Here

    LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();

    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(lc);
    lc.reset();
    configurator.doConfigure(ClassicTestConstants.JORAN_INPUT_PREFIX
        + "syslog_LBCLASSIC_50.xml");

    org.slf4j.Logger logger = LoggerFactory.getLogger(this.getClass());
    logger.info("hello");
View Full Code Here

public class JMSTopicAppenderTestApp {
 
  public static void main(String[] args) {
    Logger logger = (Logger)LoggerFactory.getLogger(JMSTopicAppenderTestApp.class);
    LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
    lc.reset();
   
    JMSTopicAppender appender = new JMSTopicAppender();
    appender.setContext(lc);
    appender.setName("jmsTopic");
    appender.setInitialContextFactoryName("org.apache.activemq.jndi.ActiveMQInitialContextFactory");
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.