Package ch.qos.logback.core.status

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


        StatusManager sm = context.getStatusManager();
        if (sm == null) {
            ps.println("WARN: Context named \"" + context.getName()
                    + "\" has no status manager");
        } else {
            StatusUtil statusUtil = new StatusUtil(context);
            if (statusUtil.getHighestLevel(threshold) >= ErrorStatus.WARN) {
                List<Status> filteredList =
                        StatusUtil.filterStatusListByTimeThreshold(sm.getCopyOfStatusList(), msgSince);
                print(filteredList, initSuccess);
            }
        }
View Full Code Here


        getStatusManager().add(statusListener);
        addInfo("Resetting context: " + getLoggerContext().getName());
        resetContext(statusListener);

        StatusUtil statusUtil = new StatusUtil(getLoggerContext());
        JoranConfigurator configurator = createConfigurator();
        final List<SaxEvent> eventList = configurator.recallSafeConfiguration();
        final long threshold = System.currentTimeMillis();
        boolean success = false;
        try {
            cb.perform(configurator);
            if (statusUtil.hasXMLParsingErrors(threshold)) {
                cb.fallbackConfiguration(eventList, createConfigurator(), statusListener);
            }
            addInfo("Context: " + getLoggerContext().getName() + " reloaded.");
            success = true;
        } catch (Throwable t) {
View Full Code Here

  public static ObjectName string2ObjectName(Context context, Object caller,
      String objectNameAsStr) {
    String msg = "Failed to convert [" + objectNameAsStr + "] to ObjectName";

    StatusUtil statusUtil = new StatusUtil(context);
    try {
      return new ObjectName(objectNameAsStr);
    } catch (MalformedObjectNameException e) {
      statusUtil.addError(caller, msg, e);
      return null;
    } catch (NullPointerException e) {
      statusUtil.addError(caller, msg, e);
      return null;
    }
  }
View Full Code Here

      MBeanServer mbs, LoggerContext loggerContext,
      JMXConfigurator jmxConfigurator, ObjectName objectName, Object caller) {
    try {
      mbs.registerMBean(jmxConfigurator, objectName);
    } catch (Exception e) {
      StatusUtil statusUtil = new StatusUtil(loggerContext);
      statusUtil.addError(caller, "Failed to create mbean", e);
    }
  }
View Full Code Here

  }

  public static void unregister(LoggerContext loggerContext, MBeanServer mbs,
      ObjectName objectName, Object caller) {

    StatusUtil statusUtil = new StatusUtil(loggerContext);
    if (mbs.isRegistered(objectName)) {
      try {
        statusUtil.addInfo(caller, "Unregistering mbean ["
            + objectName + "]");
        mbs.unregisterMBean(objectName);
      } catch (InstanceNotFoundException e) {
        // this is theoretically impossible
        statusUtil.addError(caller, "Failed to unregister mbean"
            + objectName, e);
      } catch (MBeanRegistrationException e) {
        // this is theoretically impossible
        statusUtil.addError(caller, "Failed to unregister mbean"
            + objectName, e);
      }
    } else {
      statusUtil.addInfo(caller, "mbean [" + objectName
          + "] does not seem to be registered");
    }
  }
View Full Code Here

    }

    private void performXMLConfiguration(LoggerContext lc) {
      JoranConfigurator jc = new JoranConfigurator();
      jc.setContext(context);
      StatusUtil statusUtil = new StatusUtil(context);
      List<SaxEvent> eventList = jc.recallSafeConfiguration();
      URL mainURL = ConfigurationWatchListUtil.getMainWatchURL(context);
      lc.reset();
      long threshold = System.currentTimeMillis();
      try {
        jc.doConfigure(mainConfigurationURL);
        if (statusUtil.hasXMLParsingErrors(threshold)) {
          fallbackConfiguration(lc, eventList, mainURL);
        }
      } catch (JoranException e) {
        fallbackConfiguration(lc, eventList, mainURL);
      }
View Full Code Here

    }
    SaxEventRecorder recorder = new SaxEventRecorder(context);
    recorder.recordEvents(inputSource);
    doConfigure(recorder.saxEventList);
    // no exceptions a this level
    StatusUtil statusUtil = new StatusUtil(context);
    if (statusUtil.noXMLParsingErrorsOccurred(threshold)) {
      addInfo("Registering current configuration as safe fallback point");
      registerSafeConfiguration();
    }
  }
View Full Code Here

    }
    SaxEventRecorder recorder = new SaxEventRecorder(context);
    recorder.recordEvents(inputSource);
    doConfigure(recorder.saxEventList);
    // no exceptions a this level
    StatusUtil statusUtil = new StatusUtil(context);
    if (statusUtil.noXMLParsingErrorsOccurred(threshold)) {
      addInfo("Registering current configuration as safe fallback point");
      registerSafeConfiguration();
    }
  }
View Full Code Here

TOP

Related Classes of ch.qos.logback.core.status.StatusUtil

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.