1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.logging.simple;
18
19
20 import java.util.ArrayList;
21 import java.util.List;
22 import java.text.DateFormat;
23 import org.apache.commons.logging.impl.SimpleLog;
24
25
26 /***
27 * <p>Decorated instance of SimpleLog to expose internal state and
28 * support buffered output.</p>
29 */
30
31 public class DecoratedSimpleLog extends SimpleLog {
32
33
34
35
36
37 public DecoratedSimpleLog(String name) {
38 super(name);
39 }
40
41
42
43
44 public DateFormat getDateTimeFormatter() {
45 return (dateFormatter);
46 }
47
48
49 public String getDateTimeFormat() {
50 return (dateTimeFormat);
51 }
52
53
54 public String getLogName() {
55 return (logName);
56 }
57
58
59 public boolean getShowDateTime() {
60 return (showDateTime);
61 }
62
63
64 public boolean getShowShortName() {
65 return (showShortName);
66 }
67
68
69
70
71
72
73 protected void log(int type, Object message, Throwable t) {
74
75 super.log(type, message, t);
76 cache.add(new LogRecord(type, message, t));
77
78 }
79
80
81
82
83
84
85 protected ArrayList cache = new ArrayList();
86
87
88
89 public void clearCache() {
90 cache.clear();
91 }
92
93
94
95 public List getCache() {
96 return (this.cache);
97 }
98
99
100 }