Package ch.qos.logback.core

Examples of ch.qos.logback.core.Context


  public void defaultContext() {
    MockInitialContext mic = MockInitialContextFactory.getContext();
    mic.map.put(ClassicConstants.JNDI_CONTEXT_NAME, null);

    ContextJNDISelector selector = (ContextJNDISelector)ContextSelectorStaticBinder.getSingleton().getContextSelector();
    Context context = selector.getLoggerContext();
   
    assertEquals("default", context.getName());   
  }
View Full Code Here


    if (defaultMap != null) {
      effectiveMap.putAll(defaultMap);
    }

    // contextMap is more specific than the default map
    Context context = getContext();
    if (context != null) {
      @SuppressWarnings("unchecked")
      Map<String, String> contextMap = (Map<String, String>) context
          .getObject(CoreConstants.PATTERN_RULE_REGISTRY);
      if (contextMap != null) {
        effectiveMap.putAll(contextMap);
      }
    }
View Full Code Here

* @author Ceki G&uuml;ulc&uuml;
*/
public class NewRuleCalculator {
  public static void main(String[] args) throws Exception {

    Context context = new ContextBase();

    Map<ElementSelector, Action> ruleMap = new HashMap<ElementSelector, Action>();

    // we start with the rule for the top-most (root) element
    ruleMap.put(new ElementSelector("*/computation"), new ComputationAction1());
View Full Code Here

    // Associate "hello-world" pattern with HelloWorldAction
    ruleMap.put(new ElementSelector("hello-world"), new HelloWorldAction());

    // Joran needs to work within a context.
    Context context = new ContextBase();
    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    simpleConfigurator.doConfigure(args[0]);
View Full Code Here

* @author Ceki G&uuml;ulc&uuml;
*/
public class Calculator1 {

  public static void main(String[] args) throws Exception {
    Context context = new ContextBase();

    Map<ElementSelector, Action> ruleMap = new HashMap<ElementSelector, Action>();

    // Associate "/computation" pattern with ComputationAction1
    ruleMap.put(new ElementSelector("/computation"), new ComputationAction1());
View Full Code Here

    ruleMap.put(new ElementSelector("*/computation/literal"), new LiteralAction());
    ruleMap.put(new ElementSelector("*/computation/add"), new AddAction());
    ruleMap.put(new ElementSelector("*/computation/multiply"), new MultiplyAction());
   
    Context context = new ContextBase();
    SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
    // link the configurator with its context
    simpleConfigurator.setContext(context);

    try {
View Full Code Here

* @author Ceki G&uuml;ulc&uuml;
*/
public class PrintMe {

  public static void main(String[] args) throws Exception {
    Context context = new ContextBase();

    Map<ElementSelector, Action> ruleMap = new HashMap<ElementSelector, Action>();

    // we start with the rule for the top-most (root) element
    ruleMap.put(new ElementSelector("*/foo"), new NOPAction());
View Full Code Here

    if (defaultMap != null) {
      effectiveMap.putAll(defaultMap);
    }

    // contextMap is more specific than the default map
    Context context = getContext();
    if (context != null) {
      @SuppressWarnings("unchecked")
      Map<String, String> contextMap = (Map<String, String>) context
          .getObject(CoreConstants.PATTERN_RULE_REGISTRY);
      if (contextMap != null) {
        effectiveMap.putAll(contextMap);
      }
    }
View Full Code Here

      PostCompileProcessor<E> postCompileProcessor) {
    this.postCompileProcessor = postCompileProcessor;
  }

  protected void setContextForConverters(Converter<E> head) {
    Context context = getContext();
    Converter c = head;
    while (c != null) {
      if (c instanceof ContextAware) {
        ((ContextAware) c).setContext(context);
      }
View Full Code Here

* @author Ceki G&uuml;ulc&uuml;
*/
public class PrintMe {

  public static void main(String[] args) throws Exception {
    Context context = new ContextBase();

    Map<Pattern, Action> ruleMap = new HashMap<Pattern, Action>();

    // we start with the rule for the top-most (root) element
    ruleMap.put(new Pattern("*/foo"), new NOPAction());
View Full Code Here

TOP

Related Classes of ch.qos.logback.core.Context

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.