1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.logging.simple;
19
20 import java.text.DateFormat;
21 import java.util.ArrayList;
22 import java.util.List;
23
24 import org.apache.commons.logging.impl.SimpleLog;
25
26
27
28
29
30
31 public class DecoratedSimpleLog extends SimpleLog {
32
33
34
35
36 private static final long serialVersionUID = 196544280770017153L;
37
38
39 protected ArrayList<LogRecord> cache = new ArrayList<>();
40
41 public DecoratedSimpleLog(final String name) {
42 super(name);
43 }
44
45
46 public void clearCache() {
47 cache.clear();
48 }
49
50
51 public List<LogRecord> getCache() {
52 return this.cache;
53 }
54
55 public String getDateTimeFormat() {
56 return dateTimeFormat;
57 }
58
59 public DateFormat getDateTimeFormatter() {
60 return dateFormatter;
61 }
62
63 public String getLogName() {
64 return logName;
65 }
66
67 public boolean getShowDateTime() {
68 return showDateTime;
69 }
70
71 public boolean getShowShortName() {
72 return showShortName;
73 }
74
75
76 @Override
77 protected void log(final int type, final Object message, final Throwable t) {
78
79 super.log(type, message, t);
80 cache.add(new LogRecord(type, message, t));
81
82 }
83
84 }