1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package com.mindtree.techworks.insight.spi;
25
26 import java.util.Hashtable;
27
28 import org.apache.log4j.spi.LoggingEvent;
29 import org.apache.log4j.spi.ThrowableInformation;
30 import org.apache.log4j.Logger;
31 import org.apache.log4j.Level;
32
33
34
35
36
37
38
39
40
41
42
43 public class LogEvent extends LoggingEvent {
44
45
46
47
48 private static final long serialVersionUID = -7395745277683854531L;
49
50
51
52
53 private static final String DEFAULT_STRING = "<no info available>";
54 private static final String DEFAULT_CATEGORY_CLASS_NAME = DEFAULT_STRING;
55 private static final ThrowableInformation DEFAULT_THROWABLE_INFO =
56 new ThrowableInformation( new String[] {}
57 );
58 private static final Logger DEFAULT_LOGGER = Logger.getLogger(DEFAULT_STRING);
59 private static final Level DEFAULT_LEVEL = Level.INFO;
60
61
62
63
64 private LogNamespace namespace;
65
66
67
68
69 private String exceptionName;
70
71
72
73
74 private long relativeTime;
75
76
77
78
79 public LogEvent() {
80 super();
81 }
82
83
84
85
86
87 public LogEvent(Object message) {
88 super(DEFAULT_CATEGORY_CLASS_NAME,DEFAULT_LOGGER,DEFAULT_LEVEL,message,null);
89 super.setThrowableInformation(DEFAULT_THROWABLE_INFO);
90 super.setThreadName(DEFAULT_STRING);
91 }
92
93
94
95
96
97 public LogEvent(LoggingEvent event) {
98 super(event.getLoggerName(),event.getLogger(),event.getLevel(),event.getMessage(),null);
99 super.setTimeStamp(event.getTimeStamp());
100 super.setThreadName(event.getThreadName());
101 super.setLocationInformation(event.getLocationInformation());
102 super.setNDC(event.getNDC());
103 super.setProperties(new Hashtable(event.getProperties()));
104 super.setThrowableInformation(event.getThrowableInformation());
105 }
106
107
108
109
110
111 public String[] getThrowableStrRepresentation() {
112 return super.getThrowableInformation().getThrowableStrRep();
113 }
114
115
116
117
118 public LogNamespace getNamespace() {
119 return this.namespace;
120 }
121
122
123
124
125 public void setNamespace(LogNamespace namespace) {
126 this.namespace = namespace;
127 }
128
129
130
131 public String getExceptionName() {
132 return exceptionName;
133 }
134
135
136
137 public void setExceptionName(String exceptionName) {
138 this.exceptionName = exceptionName;
139 }
140
141
142
143 public long getRelativeTime() {
144 return this.relativeTime;
145 }
146
147
148
149 public void setRelativeTime(long relativeTime) {
150 this.relativeTime = relativeTime;
151 }
152 }