public class LogRecord extends Object
When a LogRecord is passed into the logging framework it logically belongs to the framework and should no longer be used or updated by the client application.
Note that if the client application has not specified an explicit source method name and source class name, then the LogRecord class will infer them automatically when they are first accessed (due to a call on getSourceMethodName or getSourceClassName) by analyzing the call stack. Therefore, if a logging Handler wants to pass off a LogRecord to another thread, or to transmit it over RMI, and if it wishes to subsequently obtain method name or class name information it should call one of getSourceClassName or getSourceMethodName to force the values to be filled in.
Constructor and Description |
---|
LogRecord(Level level,
String msg)
Construct a LogRecord with the given level and message.
|
Modifier and Type | Method and Description |
---|---|
Level |
getLevel()
Get the logging message level.
|
String |
getLoggerName()
Get the name of the logger that logged this LogRecord.
|
String |
getMessage()
Get the raw log message.
|
long |
getMillis()
Get event time in milliseconds since 1970.
|
long |
getSequenceNumber()
Get the sequence number of the LogRecord.
|
Throwable |
getThrown()
Get the throwable associated with this log record, if any.
|
void |
setLevel(Level level)
Set the logging message level.
|
void |
setLoggerName(String name)
Set the source logger's name.
|
void |
setMessage(String message)
Set the raw log message.
|
void |
setMillis(long millis)
Set event time of the LogRecord.
|
void |
setThrown(Throwable thrown)
Set the throwable associated with this log record.
|
public Level getLevel()
@Nullable public String getLoggerName()
null
).@Nullable public String getMessage()
null
).public long getMillis()
public long getSequenceNumber()
@Nullable public Throwable getThrown()
null
).public void setLevel(Level level)
level
- the logging message level.public void setLoggerName(@Nullable String name)
name
- the source logger's name (may be null
).public void setMessage(@Nullable String message)
message
- the message to set (may be null
).public void setMillis(long millis)
millis
- event time.