1
2
3
4
5
6
7
8
9
10
11
12
13
14 package chapters.onJoran.helloWorld;
15
16 import java.util.HashMap;
17 import java.util.Map;
18
19 import ch.qos.logback.core.Context;
20 import ch.qos.logback.core.ContextBase;
21 import ch.qos.logback.core.joran.action.Action;
22 import ch.qos.logback.core.joran.spi.ElementSelector;
23 import ch.qos.logback.core.util.StatusPrinter;
24 import chapters.onJoran.SimpleConfigurator;
25
26
27
28
29
30
31
32 public class HelloWorld {
33 public static void main(String[] args) throws Exception {
34 Map<ElementSelector, Action> ruleMap = new HashMap<ElementSelector, Action>();
35
36
37 ruleMap.put(new ElementSelector("hello-world"), new HelloWorldAction());
38
39
40 Context context = new ContextBase();
41 SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
42
43 simpleConfigurator.setContext(context);
44
45 simpleConfigurator.doConfigure(args[0]);
46 StatusPrinter.print(context);
47 }
48 }