01: /*
02: * MockReader.java
03: *
04: * Created on 25. November 2002, 23:07
05: */
06:
07: package org.jzonic.jlo.reader;
08:
09: import org.jzonic.jlo.LogConfiguration;
10: import org.jzonic.jlo.LogGenerator;
11: import org.jzonic.jlo.Logger;
12: import org.jzonic.jlo.Target;
13: import org.jzonic.jlo.formatter.Formatter;
14: import org.jzonic.jlo.formatter.SimpleFormatter;
15: import org.jzonic.jlo.handler.Handler;
16: import org.jzonic.jlo.handler.MockHandler;
17:
18: /**
19: *
20: * @author Administrator
21: */
22: public class MockReader implements LogConfigurationReader {
23:
24: /** Creates a new instance of MockReader */
25: public MockReader() {
26: }
27:
28: public LogConfiguration parseConfiguration(String name)
29: throws ReaderException {
30: LogConfiguration lc = new LogConfiguration("Test");
31: Handler handler = new MockHandler("Test");
32: Formatter simpleFormatter = new SimpleFormatter("Test");
33: LogGenerator lg = new LogGenerator("org.jzonic.jlo", handler,
34: simpleFormatter);
35: Logger logger = new Logger("org.jzonic.jlo", Target
36: .parse("ALL"), "Test");
37: logger.addLogGenerator(lg);
38: lc.addLogger(logger);
39: Logger seclogger = new Logger("org.jzonic", Target
40: .parse("ALL,!INIT"), "Test");
41: seclogger.addLogGenerator(lg);
42: lc.addLogger(seclogger);
43: Logger thirdlogger = new Logger("org", Target
44: .parse("INIT,FATAL"), "Test");
45: thirdlogger.addLogGenerator(lg);
46: lc.addLogger(thirdlogger);
47: return lc;
48: }
49: }
|