Thursday, July 23, 2015

go though logback root and appender structures remove an Appender manually

LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
//StatusPrinter.print(lc);
List strList = new ArrayList();
    for (ch.qos.logback.classic.Logger log : lc.getLoggerList()) {
      if(log.getLevel() != null || hasAppenders(log)) {
    System.out.println("LOG:" + log.getName());
   
    Iterator> appenders = log.iteratorForAppenders();
    while(appenders.hasNext()){
    Appender ap = appenders.next();
    System.out.println("APPENDER:" + ap.getName());
    }
   
        strList.add(log.getName());
      }
    }

No comments:

Post a Comment