Examples of JoranConfigurator


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

    String configFile = args[0];

    if (configFile.endsWith(".xml")) {
      try {
        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext(lc);
        lc.shutdownAndReset();
        configurator.doConfigure(args[0]);
      } catch (JoranException je) {
        je.printStackTrace();
      }
    }
View Full Code Here

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

  }

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

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

    return Loader.getResourceBySelfClassLoader(resourceName);
  }

  private void configureLoggerContextByURL(LoggerContext context, URL url) {
    try {
      JoranConfigurator configurator = new JoranConfigurator();
      context.reset();
      configurator.setContext(context);
      configurator.doConfigure(url);
    } catch (JoranException e) {
    }
    StatusPrinter.printInCaseOfErrorsOrWarnings(context);
  }
View Full Code Here

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

    }
  }

  static public void configureLC(LoggerContext lc, String configFile)
      throws JoranException {
    JoranConfigurator configurator = new JoranConfigurator();
    lc.reset();
    configurator.setContext(lc);
    configurator.doConfigure(configFile);
  }
View Full Code Here

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

        }
      }
    }

    private void performXMLConfiguration(LoggerContext lc) {
      JoranConfigurator jc = new JoranConfigurator();
      jc.setContext(context);
      StatusChecker statusChecker = new StatusChecker(context);
      List<SaxEvent> eventList = jc.recallSafeConfiguration();
      URL mainURL = ConfigurationWatchListUtil.getMainWatchURL(context);
      lc.reset();
      long threshold = System.currentTimeMillis();
      try {
        jc.doConfigure(mainConfigurationURL);
        if (statusChecker.hasXMLParsingErrors(threshold)) {
          fallbackConfiguration(lc, eventList, mainURL);
        }
      } catch (JoranException e) {
        fallbackConfiguration(lc, eventList, mainURL);
View Full Code Here

Examples of org.apache.log4j.joran.JoranConfigurator

       
        if(url!=null) {
            try {
              // we temporarily swap the TCCL so that plugins can find resources
              Thread.currentThread().setContextClassLoader(classLoader);
              JoranConfigurator jc = new JoranConfigurator();
              jc.doConfigure(url, LogManager.getLoggerRepository());
            }finally{
                // now switch it back...
                Thread.currentThread().setContextClassLoader(previousTCCL);
            }
        }
View Full Code Here

Examples of org.apache.log4j.joran.JoranConfigurator

   @deprecated Replaced by the much more flexible {@link org.apache.log4j.joran.JoranConfigurator}.
   @since 0.8.3 */
public class DOMConfigurator extends JoranConfigurator {
 
  public static void configure(String file) {
    JoranConfigurator joran = new JoranConfigurator();
    joran.doConfigure(file, LogManager.getLoggerRepository());
  }
View Full Code Here

Examples of org.apache.log4j.joran.JoranConfigurator

    JoranConfigurator joran = new JoranConfigurator();
    joran.doConfigure(file, LogManager.getLoggerRepository());
  }

  public static void configure(URL url) {
    JoranConfigurator joran = new JoranConfigurator();
    joran.doConfigure(url, LogManager.getLoggerRepository());
  }
View Full Code Here

Examples of org.apache.log4j.joran.JoranConfigurator

      Layout layout = new PatternLayout("%p [%t] %c (%F:%L) - %m%n");
      root.addAppender(new ConsoleAppender(layout, ConsoleAppender.SYSTEM_OUT));
    }
    else if(args.length == 1) {
      if(args[0].endsWith("xml")) {
        JoranConfigurator jc = new JoranConfigurator();
         jc.doConfigure(args[0], LogManager.getLoggerRepository());
      } else {
          PropertyConfigurator.configure(args[0]);
      }
    } else {
      usage("Incorrect number of parameters.");
View Full Code Here

Examples of org.apache.log4j.joran.JoranConfigurator

    System.exit(1);
  }

  static
  void init(String configFile) {
    JoranConfigurator jc = new JoranConfigurator();
    jc.doConfigure(configFile, LogManager.getLoggerRepository());
  }
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.