1
2
3
4
5
6
7
8
9
10 package ch.qos.logback.access.joran.action;
11
12 import org.xml.sax.Attributes;
13
14 import ch.qos.logback.core.joran.action.Action;
15 import ch.qos.logback.core.joran.spi.InterpretationContext;
16 import ch.qos.logback.core.util.StatusPrinter;
17
18
19
20 public class ConfigurationAction extends Action {
21 static final String INTERNAL_DEBUG_ATTR = "debug";
22 boolean debugMode = false;
23
24 public void begin(InterpretationContext ec, String name, Attributes attributes) {
25 String debugAttrib = attributes.getValue(INTERNAL_DEBUG_ATTR);
26
27 if (
28 (debugAttrib == null) || debugAttrib.equals("")
29 || debugAttrib.equals("false") || debugAttrib.equals("null")) {
30 addInfo("Ignoring " + INTERNAL_DEBUG_ATTR + " attribute.");
31 } else {
32 debugMode = true;
33 }
34
35
36 ec.pushObject(getContext());
37 }
38
39 public void end(InterpretationContext ec, String name) {
40 addInfo("End of configuration.");
41 if (debugMode) {
42 StatusPrinter.print(context);
43 }
44
45 ec.popObject();
46 }
47 }