Examples of JoranConfigurator


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

                System.exit(-2);
            }

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

            // 打印服务器配置参数
            MixAll.printObjectProperties(log, namesrvConfig);
            MixAll.printObjectProperties(log, nettyServerConfig);
View Full Code Here

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

  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

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


    public static void testlog() throws JoranException {
        // 初始化Logback
        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext(lc);
        lc.reset();
        configurator.doConfigure("/Users/vive/Desktop/share/work/gitlab/rocketmq/conf/logback_broker.xml");
        final Logger log = LoggerFactory.getLogger(LoggerName.BrokerLoggerName);

        while (true) {
            log.info("hello, current time: {}", System.currentTimeMillis());
        }
View Full Code Here

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

        String rocketmqHome =
                System.getProperty(MixAll.ROCKETMQ_HOME_PROPERTY, System.getenv(MixAll.ROCKETMQ_HOME_ENV));

        // 初始化Logback
        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext(lc);
        lc.reset();
        configurator.doConfigure(rocketmqHome + "/conf/logback_tools.xml");
    }
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 ch.qos.logback.classic.joran.JoranConfigurator

        fallbackConfiguration(lc, eventList, mainURL);
      }
    }

    private void fallbackConfiguration(LoggerContext lc, List<SaxEvent> eventList, URL mainURL) {
      JoranConfigurator joranConfigurator = new JoranConfigurator();
      joranConfigurator.setContext(context);
      if (eventList != null) {
        addWarn("Falling back to previously registered safe configuration.");
        try {
          lc.reset();
          joranConfigurator.informContextOfURLUsedForConfiguration(context, mainURL);
          joranConfigurator.doConfigure(eventList);
          addInfo("Re-registering previous fallback configuration once more as a fallback configuration point");
          joranConfigurator.registerSafeConfiguration();
        } catch (JoranException e) {
          addError("Unexpected exception thrown by a configuration considered safe.", e);
        }
      } else {
        addWarn("No previous configuration to fall back to.");
View Full Code Here

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

        list = (StringListAppender<ILoggingEvent>) rootLogger.getAppender("LIST");
        rootLogger.detachAppender("console");
    }

    private static void configure(final String file) throws JoranException {
        final JoranConfigurator jc = new JoranConfigurator();
        jc.setContext(context);
        jc.doConfigure(file);
    }
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 configureLoggerContextByResource(LoggerContext context,
      String configFilePath) {
    URL url = Loader.getResourceByTCL(configFilePath);
    if (url != null) {
      try {
        JoranConfigurator configurator = new JoranConfigurator();
        context.shutdownAndReset();
        configurator.setContext(context);
        configurator.doConfigure(url);
      } catch (JoranException e) {
        StatusPrinter.print(context);
      }
    } else {
      Logger logger = defaultContext.getLogger(LoggerContext.ROOT_NAME);
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.