Package ch.qos.logback.classic.joran

Examples of ch.qos.logback.classic.joran.JoranConfigurator


          //System.out.printf("Loader tcl: %s\n", classloader2);
          //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);
            }
          } else {
            try {
View Full Code Here


  public static void configureByResource(LoggerContext loggerContext, URL url)
      throws JoranException {
    if (url == null) {
      throw new IllegalArgumentException("URL argument cannot be null");
    }
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(loggerContext);
    configurator.doConfigure(url);
  }
View Full Code Here

  public void reload(String fileName) throws JoranException {
    LoggerContext lc = (LoggerContext) context;
    addInfo("Shutting down context: " + lc.getName());
    lc.shutdownAndReset();
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(lc);
    configurator.doConfigure(fileName);
    addInfo("Context: " + lc.getName() + " reloaded.");
  }
View Full Code Here

    //String configFile = "src/main/java/chapter4/db/append-toOracle10g.xml";
    //String configFile = "src/main/java/chapter4/db/append-toMySQL.xml";
    String configFile = "src/main/java/chapter4/db/append-toSQLServer.xml";

    LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
    JoranConfigurator configurator = new JoranConfigurator();
    lc.shutdownAndReset();
    configurator.setContext(lc);
    configurator.doConfigure(configFile);
    StatusPrinter.printIfErrorsOccured(lc);
   
    Logger logger = LoggerFactory.getLogger(Main.class);

    MDC.put("x", "x");
View Full Code Here

  public void reload(String fileName) throws JoranException {
    LoggerContext lc = (LoggerContext) context;
    addInfo("Shutting down context: " + lc.getName());
    lc.shutdownAndReset();
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(lc);
    configurator.doConfigure(fileName);
    addInfo("Context: " + lc.getName() + " reloaded.");
  }
View Full Code Here

   
    Logger logger = (Logger) LoggerFactory.getLogger(FilterEvents.class);
    LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();

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

      .build();
  }

  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 {
      jc.doConfigure(input);

    } catch (JoranException e) {
      throw new SonarException("can not initialize logging", e);

    } finally {
View Full Code Here

        StatusManager sm = loggerContext.getStatusManager();
        sm.add(new ErrorStatus("Groovy classes are not available on the class path. ABORTING INITIALIZATION.",
                loggerContext));
      }
    } else if (urlString.endsWith("xml")) {
      JoranConfigurator configurator = new JoranConfigurator();
      configurator.setContext(loggerContext);
      configurator.doConfigure(url);
    } else {
      throw new LogbackException("Unexpected filename extension of file [" + url.toString() + "]. Should be either .groovy or .xml");
    }
  }
View Full Code Here

      throw new LogbackException("Unexpected filename extension of file [" + url.toString() + "]. Should be either .groovy or .xml");
    }
  }

  void joranConfigureByResource(URL url) throws JoranException {
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(loggerContext);
    configurator.doConfigure(url);
  }
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

TOP

Related Classes of ch.qos.logback.classic.joran.JoranConfigurator

Copyright © 2018 www.massapicom. 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.