Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Logback: the reliable, generic, fast and flexible logging framework. Copyright (C) 1999-2011, QOS.ch. All rights reserved. This program and the accompanying materials are dual-licensed under either the terms of the Eclipse Public License v1.0 as published by the Eclipse Foundation or (per the licensee's choosing) under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation.
package ch.qos.logback.classic.joran.action;
public class ConfigurationAction extends Action {
  static final String INTERNAL_DEBUG_ATTR = "debug";
  static final String SCAN_ATTR = "scan";
  static final String SCAN_PERIOD_ATTR = "scanPeriod";
  static final String DEBUG_SYSTEM_PROPERTY_KEY = "logback.debug";
  long threshold = 0;
  public void begin(InterpretationContext icString nameAttributes attributes) {
     = System.currentTimeMillis();
    // See LOGBACK-527 (the system property is looked up first. Thus, it overrides
    // the equivalent property in the config file. This reversal of scope priority is justified
    // by the use case: the admin trying to chase rogue config file
    String debugAttrib = System.getProperty();
    if (debugAttrib == null) {
      debugAttrib = ic.subst(attributes.getValue());
    }
    if (OptionHelper.isEmpty(debugAttrib) || debugAttrib.equalsIgnoreCase("false")
            || debugAttrib.equalsIgnoreCase("null")) {
      addInfo( + " attribute not set");
    } else {
      OnConsoleStatusListener.addNewInstanceToContext();
    }
    processScanAttrib(icattributes);
    ContextUtil contextUtil = new ContextUtil();
    contextUtil.addHostNameAsProperty();
    if(EnvUtil.isGroovyAvailable()) {
      LoggerContext lc = (LoggerContext;
      contextUtil.addGroovyPackages(lc.getFrameworkPackages());
    }
    // the context is turbo filter attachable, so it is pushed on top of the
    // stack
    ic.pushObject(getContext());
  }
  void processScanAttrib(InterpretationContext icAttributes attributes) {
    String scanAttrib = ic.subst(attributes.getValue());
    if (!OptionHelper.isEmpty(scanAttrib)
            && !"false".equalsIgnoreCase(scanAttrib)) {
      rocf.setContext();
      String scanPeriodAttrib = ic.subst(attributes.getValue());
      if (!OptionHelper.isEmpty(scanPeriodAttrib)) {
        try {
          Duration duration = Duration.valueOf(scanPeriodAttrib);
          rocf.setRefreshPeriod(duration.getMilliseconds());
          addInfo("Setting ReconfigureOnChangeFilter scanning period to "
                  + duration);
        } catch (NumberFormatException nfe) {
          addError("Error while converting [" + scanAttrib + "] to long"nfe);
        }
      }
      rocf.start();
      LoggerContext lc = (LoggerContext;
      addInfo("Adding ReconfigureOnChangeFilter as a turbo filter");
      lc.addTurboFilter(rocf);
    }
  }
  public void end(InterpretationContext ecString name) {
    addInfo("End of configuration.");
    ec.popObject();
  }
New to GrepCode? Check out our FAQ X