Package ch.qos.logback.classic.joran

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


      configurator.doConfigure(url);
    }
  }

  void joranConfigureByResource(URL url) throws JoranException {
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(loggerContext);
    configurator.doConfigure(url);
  }
View Full Code Here


* This class tests the logback appenders.
*/
public class AppenderTest extends TestCase {
    public void testAppenders() throws Exception {
        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext(lc);
        // the context was probably already configured by default configuration
        // rules
        lc.reset();
        configurator.doConfigure(getClass().getResource("logback.xml"));

        AsyncCoalescingStatisticsAppender appender = (AsyncCoalescingStatisticsAppender)
            lc.getLogger(StopWatch.DEFAULT_LOGGER_NAME).getAppender("coalescingStatistics");

        //log from a bunch of threads
View Full Code Here

        assertTrue("Expected some stop watch messages to get discarded", appender.getNumDiscardedMessages() > 0);
    }

    public void testCsvRenderer() throws Exception {
        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext(lc);
        // the context was probably already configured by default configuration
        // rules
        lc.reset();
        configurator.doConfigure(getClass().getResource("logbackWCsv.xml"));

        Logger logger = lc.getLogger("org.perf4j.CsvAppenderTest");

        for (int i = 0; i < 20; i++) {
            StopWatch stopWatch = new Slf4JStopWatch(logger);
View Full Code Here

public class AopTest extends TestCase {

    public void testAspects() throws Exception {

        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext(lc);

        // the context was probably already configured by default configuration
        // rules
        lc.reset();

        configurator.doConfigure(getClass().getResource("logback.xml"));

        ListAppender<LoggingEvent> listAppender = (ListAppender<LoggingEvent>) lc
                .getLogger(StopWatch.DEFAULT_LOGGER_NAME).getAppender(
                        "listAppender");
View Full Code Here

* Tests the JmxAttributeStatisticsAppender
*/
public class JmxAppenderTest extends TestCase {
    public void testJmxAppender() throws Exception {
        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext(lc);
        // the context was probably already configured by default configuration
        // rules
        lc.reset();
        configurator.doConfigure(getClass().getResource("logbackWJmx.xml"));

        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
        ObjectName statisticsMBeanName = new ObjectName(StatisticsExposingMBean.DEFAULT_MBEAN_NAME);

        //add a notification listener so we can check for notifications
View Full Code Here

    loggerContext.reset();
    // after a reset the statusListenerAsList gets removed as a listener
//    addStatusListener(statusListenerAsList);

    try {
      JoranConfigurator configurator = new JoranConfigurator();
      configurator.setContext(loggerContext);
      configurator.doConfigure(in);
//      addInfo("Context: " + loggerContext.getName() + " reloaded.");
    } finally {
//      removeStatusListener(statusListenerAsList);
//      if (debug) {
//        StatusPrinter.print(statusListenerAsList.getStatusList());
View Full Code Here

    if (iLoggerFactory instanceof Context) {
      final Context context = (Context) iLoggerFactory;
      final LoggerContext result = (LoggerContext) iLoggerFactory;

      final JoranConfigurator configurator = new JoranConfigurator();
      configurator.setContext(context);
      context.putProperty("WORKER_NAME", workerName);
      context.putProperty("LOG_DIRECTORY", logDirectory);

      try {
        configurator.doConfigure(GrinderProcess.class.getResource("/logback-worker.xml"));
      } catch (final JoranException e) {
        throw new EngineException("Could not initialise logger", e);
      }

      return result;
View Full Code Here

    if (loggerFactory instanceof LoggerContext) {
      LoggerContext ctx = (LoggerContext)loggerFactory;
      IPath path = RedmineCommonPlugin.getDefault().getLogFilePath();
     
      try {
        JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext(ctx);
       
        ctx.reset();
        ctx.putProperty("rmc.logfile", path.toString()); //$NON-NLS-1$
       
        configurator.doConfigure(getClass().getResourceAsStream("/logback.xml")); //$NON-NLS-1$
      } catch (JoranException e) {
        ILogService logService = LogServiceImpl.getInstance(RedmineCommonPlugin.getDefault().getBundle(), LogWriter.class);
        logService.error(e, "Logback configuration failed"); //$NON-NLS-1$
      }
    }
View Full Code Here

                System.exit(-2);
            }

            // 初始化Logback
            LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
            JoranConfigurator configurator = new JoranConfigurator();
            configurator.setContext(lc);
            lc.reset();
            configurator.doConfigure(filtersrvConfig.getRocketmqHome() + "/conf/logback_filtersrv.xml");
            log = LoggerFactory.getLogger(LoggerName.FiltersrvLoggerName);

            // 初始化服务控制对象
            final FiltersrvController controller =
                    new FiltersrvController(filtersrvConfig, nettyServerConfig);
View Full Code Here

            // Master监听Slave请求的端口,默认为服务端口+1
            messageStoreConfig.setHaListenPort(nettyServerConfig.getListenPort() + 1);

            // 初始化Logback
            LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
            JoranConfigurator configurator = new JoranConfigurator();
            configurator.setContext(lc);
            lc.reset();
            configurator.doConfigure(brokerConfig.getRocketmqHome() + "/conf/logback_broker.xml");
            final Logger log = LoggerFactory.getLogger(LoggerName.BrokerLoggerName);

            // 打印启动参数
            MixAll.printObjectProperties(log, brokerConfig);
            MixAll.printObjectProperties(log, nettyServerConfig);
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.