Examples of StatusManager


Examples of ch.qos.logback.core.status.StatusManager

          GafferConfigurator gafferConfigurator = new GafferConfigurator(lc);
          gafferConfigurator.run(fileToScan);
          lc.getStatusManager().add(
                  new InfoStatus("done resetting the logging context", this));
        } else {
          StatusManager sm = context.getStatusManager();
          sm.add(new ErrorStatus("Groovy classes are not available on the class path. ABORTING INITIALIZATION.",
                  context));
        }
      } else if (fileToScan.toString().endsWith("xml")) {
        JoranConfigurator jc = new JoranConfigurator();
        jc.setContext(context);
View Full Code Here

Examples of ch.qos.logback.core.status.StatusManager

    if (url.toString().endsWith("groovy")) {
      if (EnvUtil.isGroovyAvailable()) {
        GafferConfigurator gafferConfigurator = new GafferConfigurator(loggerContext);
        gafferConfigurator.run(url);
      } else {
        StatusManager sm = loggerContext.getStatusManager();
        sm.add(new ErrorStatus("Groovy classes are not available on the class path. ABORTING INITIALIZATION.",
                loggerContext));
      }
    }
    if (url.toString().endsWith("xml")) {
      JoranConfigurator configurator = new JoranConfigurator();
View Full Code Here

Examples of ch.qos.logback.core.status.StatusManager

    }
  }

  private void multiplicityWarning(String resourceName, ClassLoader classLoader) {
    List<URL> urlList = null;
    StatusManager sm = loggerContext.getStatusManager();
    try {
      urlList = Loader.getResourceOccurenceCount(resourceName, classLoader);
    } catch (IOException e) {
      sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]",
              loggerContext, e));
    }
    if (urlList != null && urlList.size() > 1) {
      sm.add(new WarnStatus("Resource [" + resourceName + "] occurs multiple times on the classpath.",
              loggerContext));
      for (URL url : urlList) {
        sm.add(new WarnStatus("Resource [" + resourceName + "] occurs at [" + url.toString() + "]",
                loggerContext));
      }
    }
  }
View Full Code Here

Examples of ch.qos.logback.core.status.StatusManager

      }
    }
  }

  private void statusOnResourceSearch(String resourceName, ClassLoader classLoader, URL url) {
    StatusManager sm = loggerContext.getStatusManager();
    if (url == null) {
      sm.add(new InfoStatus("Could NOT find resource [" + resourceName + "]",
              loggerContext));
    } else {
      sm.add(new InfoStatus("Found resource [" + resourceName + "] at [" + url.toString() + "]",
              loggerContext));
      multiplicityWarning(resourceName, classLoader);
    }
  }
View Full Code Here

Examples of ch.qos.logback.core.status.StatusManager

   
  private BasicConfigurator() {
  }
 
  public static void configure(LoggerContext lc) {
    StatusManager sm = lc.getStatusManager();
    if(sm != null)  {
     sm.add(new InfoStatus("Setting up default configuration.", lc));
    }
    ConsoleAppender<ILoggingEvent> ca = new ConsoleAppender<ILoggingEvent>();
    ca.setContext(lc);
    ca.setName("console");
    PatternLayout pl = new PatternLayout();
View Full Code Here

Examples of ch.qos.logback.core.status.StatusManager

    resetListenersExceptResetResistant();
    resetStatusListeners();
  }

  private void resetStatusListeners() {
    StatusManager sm = getStatusManager();
    for (StatusListener sl : sm.getCopyOfStatusListenerList()) {
      sm.remove(sl);
    }
  }
View Full Code Here

Examples of ch.qos.logback.core.status.StatusManager

  public static void printInCaseOfErrorsOrWarnings(Context context) {
    if (context == null) {
      throw new IllegalArgumentException("Context argument cannot be null");
    }

    StatusManager sm = context.getStatusManager();
    if (sm == null) {
      ps.println("WARN: Context named \"" + context.getName()
          + "\" has no status manager");
    } else {
      if (sm.getLevel() == ErrorStatus.WARN || (sm.getLevel() == ErrorStatus.ERROR) ) {
        print(sm);
      }
    }
  }
View Full Code Here

Examples of ch.qos.logback.core.status.StatusManager

  public static void printIfErrorsOccured(Context context) {
    if (context == null) {
      throw new IllegalArgumentException("Context argument cannot be null");
    }

    StatusManager sm = context.getStatusManager();
    if (sm == null) {
      ps.println("WARN: Context named \"" + context.getName()
          + "\" has no status manager");
    } else {
      if (sm.getLevel() == ErrorStatus.ERROR) {
        print(sm);
      }
    }
  }
View Full Code Here

Examples of ch.qos.logback.core.status.StatusManager

  public static void print(Context context) {
    if (context == null) {
      throw new IllegalArgumentException("Context argument cannot be null");
    }

    StatusManager sm = context.getStatusManager();
    if (sm == null) {
      ps.println("WARN: Context named \"" + context.getName()
          + "\" has no status manager");
    } else {
      print(sm);
View Full Code Here

Examples of ch.qos.logback.core.status.StatusManager

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