Package org.apache.logging.log4j.status
Class StatusData
- java.lang.Object
-
- org.apache.logging.log4j.status.StatusData
-
- All Implemented Interfaces:
java.io.Serializable
public class StatusData extends java.lang.Object implements java.io.SerializableThe Status data.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private @Nullable java.lang.StackTraceElementcallerprivate java.time.Instantinstantprivate java.time.format.DateTimeFormatterinstantFormatterprivate Levellevelprivate Messagemessageprivate static longserialVersionUIDprivate java.lang.StringthreadNameprivate @Nullable java.lang.Throwablethrowable
-
Constructor Summary
Constructors Constructor Description StatusData(@Nullable java.lang.StackTraceElement caller, Level level, Message message, @Nullable java.lang.Throwable throwable, @Nullable java.lang.String threadName)Constructs the instance using given properties.StatusData(@Nullable java.lang.StackTraceElement caller, Level level, Message message, @Nullable java.lang.Throwable throwable, @Nullable java.lang.String threadName, @Nullable java.time.format.DateTimeFormatter instantFormatter, java.time.Instant instant)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringgetFormattedStatus()Formats the event in to a log line for viewing.java.time.InstantgetInstant()Returns the instant of the event.LevelgetLevel()Returns the logging level for the event.MessagegetMessage()Returns the message associated with the event.@Nullable java.lang.StackTraceElementgetStackTraceElement()Returns the method that created the event.java.lang.StringgetThreadName()Returns the name of the thread associated with the event.@Nullable java.lang.ThrowablegetThrowable()Returns the error associated with the event.longgetTimestamp()Deprecated.since 2.23.0, usegetInstant()instead.java.lang.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
instant
private final java.time.Instant instant
-
instantFormatter
private final java.time.format.DateTimeFormatter instantFormatter
-
caller
private final @Nullable java.lang.StackTraceElement caller
-
level
private final Level level
-
message
private final Message message
-
threadName
private final java.lang.String threadName
-
throwable
private final @Nullable java.lang.Throwable throwable
-
-
Constructor Detail
-
StatusData
public StatusData(@Nullable java.lang.StackTraceElement caller, Level level, Message message, @Nullable java.lang.Throwable throwable, @Nullable java.lang.String threadName)Constructs the instance using given properties.- Parameters:
caller- the method that created the eventlevel- a logging levelmessage- a messagethrowable- the error occurredthreadName- the thread name- Since:
- 2.4
-
-
Method Detail
-
getInstant
public java.time.Instant getInstant()
Returns the instant of the event.- Returns:
- the event's instant
- Since:
- 2.23.0
-
getTimestamp
@Deprecated public long getTimestamp()
Deprecated.since 2.23.0, usegetInstant()instead.Returns the instant of the event.- Returns:
- the event's instant
-
getStackTraceElement
public @Nullable java.lang.StackTraceElement getStackTraceElement()
Returns the method that created the event.- Returns:
- the method that created the event
-
getLevel
public Level getLevel()
Returns the logging level for the event.- Returns:
- the event's logging level
-
getMessage
public Message getMessage()
Returns the message associated with the event.- Returns:
- the message associated with the event
-
getThreadName
public java.lang.String getThreadName()
Returns the name of the thread associated with the event.- Returns:
- the name of the thread associated with the event
- Since:
- 2.4
-
getThrowable
public @Nullable java.lang.Throwable getThrowable()
Returns the error associated with the event.- Returns:
- the error associated with the event
-
getFormattedStatus
public java.lang.String getFormattedStatus()
Formats the event in to a log line for viewing.- Returns:
- the formatted event
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-