001: /*
002: * Created on 19.09.2006 by holger
003: *
004: * (c) Copyright 2006, Syscon Ingenieurbüro für Mess- und Datentechnik GmbH.
005: * All Rights Reserved.
006: */
007: package log4j;
008:
009: import java.util.Date;
010:
011: /**
012: * A <code>LogEntry</code> holds all information of a <code>LoggingEvent</code> which has
013: * to be saved to the database.
014: *
015: * @author <a href="mailto:holger.west@syscon-informatics.de">Holger West</a>
016: */
017: public class LogEntry {
018: // -----------------------------------------------------------------------------------
019:
020: /** The identity of this object. */
021: private Integer _id;
022:
023: /** Timestamp when the log entry was created. */
024: private Date _timestamp;
025:
026: /** Class name where the log entry was created. */
027: private String _className;
028:
029: /** The logging level. */
030: private String _level;
031:
032: /** Thread on which the log entry was created. */
033: private String _thread;
034:
035: /** The logging message. */
036: private String _message;
037:
038: /** Counter of the occurence of a <code>LogEntry</code>. */
039: private Integer _count;
040:
041: /** Reference to a related exception. */
042: private LogExceptionEntry _exception;
043:
044: // -----------------------------------------------------------------------------------
045:
046: /**
047: * Default constructor.
048: */
049: public LogEntry() {
050: }
051:
052: /**
053: * Construct a new <code>LogEntry</code> with the given message.
054: *
055: * @param message The message to set for this <code>LogEntry</code>.
056: */
057: public LogEntry(final String message) {
058: _message = message;
059: }
060:
061: // -----------------------------------------------------------------------------------
062:
063: /**
064: * Get the identity of this object.
065: *
066: * @return The identity of this object.
067: */
068: public final Integer getId() {
069: return _id;
070: }
071:
072: /**
073: * Set the identity of this object.
074: *
075: * @param id The identity of this object.
076: */
077: public final void setId(final Integer id) {
078: _id = id;
079: }
080:
081: /**
082: * Get the timestamp when the <code>LoggingEvent</code> was created.
083: *
084: * @return Timestamp when the <code>LoggingEvent</code> was created.
085: */
086: public final Date getTimestamp() {
087: return _timestamp;
088: }
089:
090: /**
091: * Set the timestamp when the <code>LoggingEvent</code> was created.
092: *
093: * @param timestamp Timestamp when the <code>LoggingEvent</code> was created.
094: */
095: public final void setTimestamp(final Date timestamp) {
096: _timestamp = timestamp;
097: }
098:
099: /**
100: * Get the class name where the <code>LoggingEvent</code> was created.
101: *
102: * @return Class name where the <code>LoggingEvent</code> was created.
103: */
104: public final String getClassName() {
105: return _className;
106: }
107:
108: /**
109: * Set the class name where the <code>LoggingEvent</code> was created.
110: *
111: * @param className Class name where the <code>LoggingEvent</code> was created.
112: */
113: public final void setClassName(final String className) {
114: _className = className;
115: }
116:
117: /**
118: * Get the logging level.
119: *
120: * @return Logging level.
121: */
122: public final String getLevel() {
123: return _level;
124: }
125:
126: /**
127: * Set the logging level.
128: *
129: * @param level Logging level.
130: */
131: public final void setLevel(final String level) {
132: _level = level;
133: }
134:
135: /**
136: * Get the thread on which the <code>LoggingEvent</code> was created.
137: *
138: * @return Thread on which the <code>LoggingEvent</code> was created.
139: */
140: public final String getThread() {
141: return _thread;
142: }
143:
144: /**
145: * Set the thread on which the <code>LoggingEvent</code> was created.
146: *
147: * @param thread Thread on which the <code>LoggingEvent</code> was created.
148: */
149: public final void setThread(final String thread) {
150: _thread = thread;
151: }
152:
153: /**
154: * Get the logging message.
155: *
156: * @return Logging message.
157: */
158: public final String getMessage() {
159: return _message;
160: }
161:
162: /**
163: * Set the logging message.
164: *
165: * @param message Logging message.
166: */
167: public final void setMessage(final String message) {
168: _message = message;
169: }
170:
171: /**
172: * Get the count of occurences of the <code>LoggingEvent</code>.
173: *
174: * @return Count of occurences of the <code>LoggingEvent</code>.
175: */
176: public final Integer getCount() {
177: return _count;
178: }
179:
180: /**
181: * Set the count of occurences of the <code>LoggingEvent</code>.
182: *
183: * @param count Count of occurences of the <code>LoggingEvent</code>.
184: */
185: public final void setCount(final Integer count) {
186: _count = count;
187: }
188:
189: /**
190: * Get a reference to a related exception.
191: *
192: * @return A reference to a related exception.
193: */
194: public final LogExceptionEntry getException() {
195: return _exception;
196: }
197:
198: /**
199: * Set a reference to a related exception.
200: *
201: * @param exception A reference to a related exception.
202: */
203: public final void setException(final LogExceptionEntry exception) {
204: _exception = exception;
205: }
206:
207: // -----------------------------------------------------------------------------------
208: }
|