Package ch.qos.logback.classic.joran

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


  public void tearDown() {
    StatusPrinter.printIfErrorsOccured(context);
  }

  void configure(String file) throws JoranException {
    JoranConfigurator jc = new JoranConfigurator();
    jc.setContext(context);
    jc.doConfigure(file);
  }
View Full Code Here


  @Test
  public void LBCLASSIC_50() throws JoranException {

    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

    }
    if (isSilentMode()) {
      level = "ERROR";
    }
    final Context context = (Context) LoggerFactory.getILoggerFactory();
    final JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(context);
    context.putProperty("LOG_LEVEL", level);
    context.putProperty("LOG_DIRECTORY", logDirectory.getAbsolutePath());
    try {
      configurator.doConfigure(getClass().getResource("/logback-agent.xml"));
    } catch (JoranException e) {
      LOGGER.error("Error while configuring logger", e);
    }
  }
View Full Code Here

   * @param verbose verbose mode?
   */
  protected void setupLogger(boolean verbose) {
    this.verbose = verbose;
    final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    final JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(context);
    context.reset();
    context.putProperty("LOG_LEVEL", verbose ? "DEBUG" : "INFO");
    File logbackConf = home.getSubFile("logback.xml");
    try {
      if (!logbackConf.exists()) {
        logbackConf = new ClassPathResource("/logback/logback-ngrinder.xml").getFile();
        if (exHome.exists() && isClustered()) {
          context.putProperty("LOG_DIRECTORY", exHome.getGlobalLogFile().getAbsolutePath());
          context.putProperty("SUFFIX", "_" + getRegion());
        } else {
          context.putProperty("SUFFIX", "");
          context.putProperty("LOG_DIRECTORY", home.getGlobalLogFile().getAbsolutePath());
        }
      }
      configurator.doConfigure(logbackConf);
    } catch (JoranException e) {
      CoreLogger.LOGGER.error(e.getMessage(), e);
    } catch (IOException e) {
      CoreLogger.LOGGER.error(e.getMessage(), e);
    }
View Full Code Here

    }
    return baos.toByteArray();
  }

  private void configure(String file) throws JoranException {
    JoranConfigurator jc = new JoranConfigurator();
    jc.setContext(loggerContext);
    loggerContext.putProperty("port", "" + port);
    jc.doConfigure(file);
  }
View Full Code Here

  @Test
  public void lbcore211() throws JoranException {

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

    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(lc);
    lc.reset();
    configurator.doConfigure("/home/ceki/lbcore211.xml");

    Logger l = lc.getLogger("file.logger");
    StatusPrinter.print(lc);
    for (int i = 0; i < 10; i++) {
      l.info("hello " + i);
View Full Code Here

public class Main {
  public static void main(String[] args) throws JoranException {

    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    context.reset();
    JoranConfigurator joranConfigurator = new JoranConfigurator();
    joranConfigurator.setContext(context);
    joranConfigurator.doConfigure("src/test/java/ch/qos/logback/classic/issue/DarioCampagna/logback-marker.xml");
    IMessageConveyor mc = new MessageConveyor(Locale.getDefault());
    LocLoggerFactory llFactory_default = new LocLoggerFactory(mc);
    LocLogger locLogger = llFactory_default.getLocLogger("defaultLocLogger");
    Marker alwaysMarker = MarkerFactory.getMarker("ALWAYS");
    locLogger.info(alwaysMarker, "This will always appear.");
View Full Code Here

    return (DriverManagerConnectionSource) dbAppender.getConnectionSource();

  }

  public void doTest(String configFile) throws JoranException, SQLException {
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(lc);
    configurator.doConfigure(configFile);

    Logger logger = lc.getLogger(DBAppenderIntegrationTest.class);

    // the key userid is used in SiftingAppender test
    // suffix with diff to avoid collision
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

    reader.setEntityResolver(resolver);
    return reader.read(new ByteArrayInputStream(output.getBytes()));
  }

  void configure(String file) throws JoranException {
    JoranConfigurator jc = new JoranConfigurator();
    jc.setContext(lc);
    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.