Package ch.qos.logback.classic

Examples of ch.qos.logback.classic.LoggerContext


      return EMPTY;
    }
   
    loggerName = loggerName.trim();
   
    LoggerContext lc = (LoggerContext) context;
    Logger logger = lc.exists(loggerName);
    if (logger != null) {
      return logger.getEffectiveLevel().toString();
    } else {
      return EMPTY;
    }
View Full Code Here


      return EMPTY;
    }
  }

  public List<Logger> getLoggerList() {
    LoggerContext lc = (LoggerContext)context;
    return lc.getLoggerList();
  }
View Full Code Here

    }


    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

    String tcfBindingName = args[0];
    String topicBindingName = args[1];
//    String username = args[2];
//    String password = args[3];

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

    new JMSTopicSink(tcfBindingName, topicBindingName, null, null);
View Full Code Here

  }

  public void initialize() {
    try {
      // let's configure a default context
      LoggerContext defaultLoggerContext = new LoggerContext();
      defaultLoggerContext.setName("default");
      try {
        ContextInitializer.autoConfig(defaultLoggerContext);
      } catch (JoranException je) {
        // TODO test me
        Util.reportFailure("Failed to auto configure default logger context",
View Full Code Here

 
  public void begin(ExecutionContext ec, String name, Attributes attributes) {
    inError = false;
    //logger.debug("In begin method");

    LoggerContext loggerContext = (LoggerContext) this.context;
    root = loggerContext.getLogger(LoggerContext.ROOT_NAME);

    //getLogger().debug("Pushing root logger on stack");
    ec.pushObject(root);
  }
View Full Code Here

   * should always be the same object
   */
  private final ILoggerFactory loggerFactory;
 
  private StaticLoggerBinder() {
    LoggerContext lc = new LoggerContext();
     lc.setName("default");
    loggerFactory = lc;
  }
View Full Code Here

 
  public void begin(ExecutionContext ec, String name, Attributes attributes) {
    // Let us forget about previous errors (in this object)
    inError = false;

    LoggerContext loggerContext = (LoggerContext) this.context;

    // Create a new org.apache.log4j.Category object from the <category> element.
    String loggerName = attributes.getValue(NAME_ATTRIBUTE);

    if (OptionHelper.isEmpty(loggerName)) {
      inError = true;

      String line =
        ", around line " + getLineNumber(ec) + " column "
        + getColumnNumber(ec);

      String errorMsg = "No 'name' attribute in element " + name + line;
      addError(errorMsg);

      return;
    }

    //getLogger().debug("Logger name is [" + loggerName + "].");

    Logger l = loggerContext.getLogger(loggerName);
   

    boolean additive =
      OptionHelper.toBoolean(
        attributes.getValue(ActionConst.ADDITIVITY_ATTRIBUTE), true);
View Full Code Here

public class LoggerStatusPrinter {
 
  public static void printStatusInDefaultContext() {
    Logger logger = (Logger)LoggerFactory.getLogger(LoggerStatusPrinter.class);
    LoggerContext lc = logger.getLoggerContext();
    StatusManager sm = lc.getStatusManager();
    StatusPrinter.print(sm);
  }
View Full Code Here

    private static void initLogback() throws JoranException {
        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

TOP

Related Classes of ch.qos.logback.classic.LoggerContext

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.