View Javadoc

1   /**
2    * Logback: the generic, reliable, fast and flexible logging framework.
3    * 
4    * Copyright (C) 1999-2007, QOS.ch
5    * 
6    * This library is free software, you can redistribute it and/or modify it under
7    * the terms of the GNU Lesser General Public License as published by the Free
8    * Software Foundation.
9    */
10   
11  package ch.qos.logback.access.joran;
12  
13  
14  import ch.qos.logback.access.PatternLayout;
15  import ch.qos.logback.access.joran.action.ConfigurationAction;
16  import ch.qos.logback.access.joran.action.EvaluatorAction;
17  import ch.qos.logback.access.sift.SiftAction;
18  import ch.qos.logback.core.AppenderBase;
19  import ch.qos.logback.core.joran.JoranConfiguratorBase;
20  import ch.qos.logback.core.joran.action.AppenderRefAction;
21  import ch.qos.logback.core.joran.action.NOPAction;
22  import ch.qos.logback.core.joran.spi.DefaultNestedComponentRegistry;
23  import ch.qos.logback.core.joran.spi.Pattern;
24  import ch.qos.logback.core.joran.spi.RuleStore;
25  
26  
27  
28  /**
29   *
30   * @author Ceki Gülcü
31   */
32  public class JoranConfigurator extends JoranConfiguratorBase {
33  
34    @Override
35    public void addInstanceRules(RuleStore rs) {
36      super.addInstanceRules(rs);
37      
38      rs.addRule(new Pattern("configuration"), new ConfigurationAction());
39      rs.addRule(new Pattern("configuration/appender-ref"), new AppenderRefAction());
40      
41      rs.addRule(new Pattern("configuration/appender/sift"), new SiftAction());
42      rs.addRule(new Pattern("configuration/appender/sift/*"), new NOPAction());
43      
44      rs.addRule(new Pattern("configuration/evaluator"), new EvaluatorAction());
45    }
46  
47    @Override
48    protected void addDefaultNestedComponentRegistryRules(
49        DefaultNestedComponentRegistry registry) {
50      registry.add(AppenderBase.class, "layout", PatternLayout.class);
51    }
52  
53  }