org.apache.logging.log4j.core
Interface LogEvent

All Superinterfaces:
Serializable
All Known Implementing Classes:
AbstractLogEventWrapperEntity, BasicLogEventEntity, Log4jLogEvent, RingBufferLogEvent

public interface LogEvent
extends Serializable


Method Summary
 Map<String,String> getContextMap()
          Get the MDC data.
 ThreadContext.ContextStack getContextStack()
          Get the NDC data.
 String getFQCN()
          Returns the fully qualified class name of the caller of the logging api.
 Level getLevel()
          Get level.
 String getLoggerName()
          Get logger name.
 Marker getMarker()
          Get the Marker associated with the event.
 Message getMessage()
          Get the message associated with the event.
 long getMillis()
          Get event time in milliseconds since 1970.
 StackTraceElement getSource()
          Get source of logging request.
 String getThreadName()
          Get thread name.
 Throwable getThrown()
          Get throwable associated with logging request.
 boolean isEndOfBatch()
          Returns true if this event is the last one in a batch, false otherwise.
 boolean isIncludeLocation()
          Returns whether the source of the logging request is required downstream.
 void setEndOfBatch(boolean endOfBatch)
          Sets whether this event is the last one in a batch.
 void setIncludeLocation(boolean locationRequired)
          Sets whether the source of the logging request is required downstream.
 

Method Detail

getLevel

Level getLevel()
Get level.

Returns:
level.

getLoggerName

String getLoggerName()
Get logger name.

Returns:
logger name, may be null.

getSource

StackTraceElement getSource()
Get source of logging request.

Returns:
source of logging request, may be null.

getMessage

Message getMessage()
Get the message associated with the event.

Returns:
message.

getMarker

Marker getMarker()
Get the Marker associated with the event.

Returns:
Marker

getThreadName

String getThreadName()
Get thread name.

Returns:
thread name, may be null.

getMillis

long getMillis()
Get event time in milliseconds since 1970.

Returns:
milliseconds since 1970.

getThrown

Throwable getThrown()
Get throwable associated with logging request.

Returns:
throwable, may be null.

getContextMap

Map<String,String> getContextMap()
Get the MDC data.

Returns:
A copy of the Mapped Diagnostic Context or null.

getContextStack

ThreadContext.ContextStack getContextStack()
Get the NDC data.

Returns:
A copy of the Nested Diagnostic Context or null;

getFQCN

String getFQCN()
Returns the fully qualified class name of the caller of the logging api.

Returns:
The fully qualified class name of the caller.

isIncludeLocation

boolean isIncludeLocation()
Returns whether the source of the logging request is required downstream. Asynchronous Loggers and Appenders use this flag to determine whether to take a StackTrace snapshot or not before handing off this event to another thread.

Returns:
true if the source of the logging request is required downstream, false otherwise.
See Also:
getSource()

setIncludeLocation

void setIncludeLocation(boolean locationRequired)
Sets whether the source of the logging request is required downstream. Asynchronous Loggers and Appenders use this flag to determine whether to take a StackTrace snapshot or not before handing off this event to another thread.

Parameters:
locationRequired - true if the source of the logging request is required downstream, false otherwise.
See Also:
getSource()

isEndOfBatch

boolean isEndOfBatch()
Returns true if this event is the last one in a batch, false otherwise. Used by asynchronous Loggers and Appenders to signal to buffered downstream components when to flush to disk, as a more efficient alternative to the immediateFlush=true configuration.

Returns:
whether this event is the last one in a batch.

setEndOfBatch

void setEndOfBatch(boolean endOfBatch)
Sets whether this event is the last one in a batch. Used by asynchronous Loggers and Appenders to signal to buffered downstream components when to flush to disk, as a more efficient alternative to the immediateFlush=true configuration.

Parameters:
endOfBatch - true if this event is the last one in a batch, false otherwise.


Copyright © 1999-2013 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.