|
Log4j 1.2.8 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.log4j.lf5.LogRecord
LogRecord. A LogRecord encapsulates the details of your desired log request.
Field Summary | |
protected java.lang.String |
_category
|
protected LogLevel |
_level
|
protected java.lang.String |
_location
|
protected java.lang.String |
_message
|
protected long |
_millis
|
protected java.lang.String |
_ndc
|
protected static long |
_seqCount
|
protected long |
_sequenceNumber
|
protected java.lang.String |
_thread
|
protected java.lang.Throwable |
_thrown
|
protected java.lang.String |
_thrownStackTrace
|
Constructor Summary | |
LogRecord()
|
Method Summary | |
java.lang.String |
getCategory()
Get the category asscociated with this LogRecord. |
LogLevel |
getLevel()
Get the level of this LogRecord. |
java.lang.String |
getLocation()
Get the location in code where this LogRecord originated. |
java.lang.String |
getMessage()
Get the message asscociated with this LogRecord. |
long |
getMillis()
Get the event time of this record in milliseconds from 1970. |
java.lang.String |
getNDC()
Get the NDC (nested diagnostic context) for this record. |
protected static long |
getNextId()
|
long |
getSequenceNumber()
Get the sequence number associated with this LogRecord. |
java.lang.String |
getThreadDescription()
Get the thread description asscociated with this LogRecord. |
java.lang.Throwable |
getThrown()
Get the Throwable associated with this LogRecord. |
java.lang.String |
getThrownStackTrace()
Get the stack trace in a String-based format for the associated Throwable of this LogRecord. |
boolean |
hasThrown()
|
boolean |
isFatal()
|
abstract boolean |
isSevereLevel()
Abstract method. |
static void |
resetSequenceNumber()
Resets that sequence number to 0. |
void |
setCategory(java.lang.String category)
Set the category associated with this LogRecord. |
void |
setLevel(LogLevel level)
Set the level of this LogRecord. |
void |
setLocation(java.lang.String location)
Set the location in code where this LogRecord originated. |
void |
setMessage(java.lang.String message)
Set the message associated with this LogRecord. |
void |
setMillis(long millis)
Set the event time of this record. |
void |
setNDC(java.lang.String ndc)
Set the NDC (nested diagnostic context) for this record. |
void |
setSequenceNumber(long number)
Set the sequence number assocsiated with this LogRecord. |
void |
setThreadDescription(java.lang.String threadDescription)
Set the thread description associated with this LogRecord. |
void |
setThrown(java.lang.Throwable thrown)
Set the Throwable associated with this LogRecord. |
void |
setThrownStackTrace(java.lang.String trace)
Set the ThrownStackTrace for the log record. |
java.lang.String |
toString()
Return a String representation of this LogRecord. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static long _seqCount
protected LogLevel _level
protected java.lang.String _message
protected long _sequenceNumber
protected long _millis
protected java.lang.String _category
protected java.lang.String _thread
protected java.lang.String _thrownStackTrace
protected java.lang.Throwable _thrown
protected java.lang.String _ndc
protected java.lang.String _location
Constructor Detail |
public LogRecord()
Method Detail |
public LogLevel getLevel()
setLevel(LogLevel)
,
LogLevel
public void setLevel(LogLevel level)
level
- The LogLevel for this record.getLevel()
,
LogLevel
public abstract boolean isSevereLevel()
public boolean hasThrown()
public boolean isFatal()
public java.lang.String getCategory()
setCategory(String)
public void setCategory(java.lang.String category)
When logging messages
for a particluar class you can use its class name:
com.thoughtworks.framework.servlet.ServletServiceBroker.
Futhermore, to log a message for a particular method in a class
add the method name:
com.thoughtworks.framework.servlet.ServletServiceBroker.init().
category
- The category for this record.getCategory()
public java.lang.String getMessage()
setMessage(String)
public void setMessage(java.lang.String message)
message
- The message for this record.getMessage()
public long getSequenceNumber()
setSequenceNumber(long)
public void setSequenceNumber(long number)
number
- The sequence number.getSequenceNumber()
public long getMillis()
setMillis(long)
public void setMillis(long millis)
millis
- The time in milliseconds from 1970.getMillis()
public java.lang.String getThreadDescription()
setThreadDescription(String)
public void setThreadDescription(java.lang.String threadDescription)
threadDescription
- The description of the thread for this record.getThreadDescription()
public java.lang.String getThrownStackTrace()
Why do we need this method considering that we have the getThrown() and setThrown() methods? A Throwable object may not be serializable, however, a String representation of it is. Users of LogRecords should generally call this method over getThrown() for the reasons of serialization.
setThrown(Throwable)
,
getThrown()
public void setThrownStackTrace(java.lang.String trace)
trace
- A String to associate with this LogRecordgetThrownStackTrace()
public java.lang.Throwable getThrown()
setThrown(Throwable)
,
getThrownStackTrace()
public void setThrown(java.lang.Throwable thrown)
thrown
- A Throwable to associate with this LogRecord.getThrown()
,
getThrownStackTrace()
public java.lang.String toString()
public java.lang.String getNDC()
public void setNDC(java.lang.String ndc)
ndc
- A string representing the NDC.public java.lang.String getLocation()
public void setLocation(java.lang.String location)
public static void resetSequenceNumber()
protected static long getNextId()
|
Log4j 1.2.8 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |