Package ch.qos.logback.classic.joran

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


            // 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


        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

    return INFO;

  }

  protected void configure(final ServletContext sc, final URL location, final LoggerContext lc) {
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(lc);
    lc.stop();
    try {
      configurator.doConfigure(location);
    } catch (JoranException e) {
      sc.log("Failed to configure logback.", e);
    }
    StatusPrinter.printInCaseOfErrorsOrWarnings(lc);
  }
View Full Code Here

      e.printStackTrace();
      usage("Could not interpret port number [" + portStr + "].");
    }

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

    File dir = new File(dirStr);
    if (!dir.isDirectory()) {
      usage("[" + dirStr + "] is not a directory.");
    }
View Full Code Here

      File configFile = new File(dir, key + CONFIG_FILE_EXT);
      if (configFile.exists()) {
        LoggerContext lc = new LoggerContext();
        hierarchyMap.put(inetAddress, lc);

        JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext(lc);
        configurator.doConfigure(configFile);

        return lc;
      } else {
        logger.warn("Could not find config file [" + configFile + "].");
        return genericHierarchy();
View Full Code Here

  LoggerContext genericHierarchy() {
    if (genericHierarchy == null) {
      File f = new File(dir, GENERIC + CONFIG_FILE_EXT);
      if (f.exists()) {
        genericHierarchy = new LoggerContext();
        JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext(genericHierarchy);
        configurator.doConfigure(f.getAbsolutePath());

      } else {
        logger.warn("Could not find config file [" + f
            + "]. Will use the default hierarchy.");
        genericHierarchy = new LoggerContext();
View Full Code Here

      usage("Could not interpret port number [" + portStr + "].");
    }

    if (configFile.endsWith(".xml")) {
      LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
      JoranConfigurator configurator = new JoranConfigurator();
      configurator.setContext(lc);
      configurator.doConfigure(configFile);
    }
  }
View Full Code Here

    }

    LoggerContext lc = (LoggerContext) ilf;

    try {
      JoranConfigurator configurator = new JoranConfigurator();
      configurator.setContext(lc);
      // the context was probably already configured by
      // default configuration rules
      lc.reset();
      configurator.doConfigure(file);

      // Save the filepath after loading the file
      filepath = file.getAbsolutePath();
    } catch (JoranException je) {}
View Full Code Here

    NOPAppender nopAppender = new NOPAppender();
    nopAppender.setContext(context);
    nopAppender.start();

    try {
      JoranConfigurator configurator = new JoranConfigurator();
      configurator.setContext(context);

      context.reset();

      // placeholder to avoid 'No appenders present' while reconfiguring
      context.getLogger(Logger.ROOT_LOGGER_NAME).addAppender(nopAppender);

      // restore persisted setting so pax-logging can reload
      context.putObject(PAX_BUNDLE_CONTEXT_KEY, bundleContext);

      context.getStatusManager().clear();
      installNonResetResistantListeners();
      configurator.doConfigure(file);
    }
    catch (JoranException e) {
      e.printStackTrace();
    }
View Full Code Here

        }

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

        try {
            JoranConfigurator configurator = new JoranConfigurator();
            configurator.setContext(loggerContext);
            // Call context.reset() to clear any previous configuration, e.g. default
            // configuration. For multi-step configuration, omit calling context.reset().
            loggerContext.reset();
            configurator.doConfigure(logfile);
        } catch (JoranException je) {
            // StatusPrinter will handle this
        }
        StatusPrinter.printInCaseOfErrorsOrWarnings(loggerContext);
    }
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.