Top Description Inners Fields Constructors Methods
org.apache.logging.log4j.status

public final Class StatusLogger

extends AbstractLogger
Class Inheritance
Imports
java.io.Closeable, .IOException, java.util.ArrayList, .Collection, .List, .Queue, java.util.concurrent.ConcurrentLinkedQueue, .CopyOnWriteArrayList, java.util.concurrent.locks.Lock, .ReadWriteLock, .ReentrantLock, .ReentrantReadWriteLock, org.apache.logging.log4j.Level, .Marker, org.apache.logging.log4j.message.Message, .MessageFactory, .ParameterizedNoReferenceMessageFactory, org.apache.logging.log4j.simple.SimpleLogger, .SimpleLoggerContext, org.apache.logging.log4j.spi.AbstractLogger, org.apache.logging.log4j.util.Constants, .PropertiesUtil

Records events that occur in the logging system. By default, only error messages are logged to System#err. Normally, the Log4j StatusLogger is configured via the root <Configuration status="LEVEL"/> node in a Log4j configuration file. However, this can be overridden via a system property named log4j2.StatusLogger.level and will work with any Log4j provider.
See Also
SimpleLogger, SimpleLoggerContext

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
StatusLogger.BoundedQueue<
Object type to be stored in the queue.
E
>

Queues for status events.

Field Summary

Modifier and TypeField and Description
pack-priv static final boolean
private static final String
public static final String
DEFAULT_STATUS_LISTENER_LEVEL

System property that can be configured with the Level name to use as the default level for StatusListeners.

private final Collection<StatusListener>
private int
private final ReadWriteLock
private final SimpleLogger
private static final int
public static final String
MAX_STATUS_ENTRIES

System property that can be configured with the number of entries in the queue.

private final Queue<StatusData>
private final Lock
private static final String
pack-priv static final PropertiesUtil
private static final long
public static final String
STATUS_DATE_FORMAT

System property that can be configured with a date-time format string to use as the format for timestamps in the status logger output.

private static final StatusLogger
Inherited from org.apache.logging.log4j.spi.AbstractLogger:
CATCHING_MARKERDEFAULT_FLOW_MESSAGE_FACTORY_CLASSDEFAULT_MESSAGE_FACTORY_CLASSENTRY_MARKEREXCEPTION_MARKEREXIT_MARKERFLOW_MARKERnameTHROWING_MARKER

Constructor Summary

AccessConstructor and Description
private
StatusLogger(final String
The logger name.
name
,
final MessageFactory
The message factory.
messageFactory
,
final SimpleLoggerFactory loggerFactory)

Constructs the singleton instance for the STATUS_LOGGER constant.

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Clears the list of status events.

private static void
closeSilently(final Closeable resource)

public Level
getLevel()

Implements org.apache.logging.log4j.Logger.getLevel.

Gets the Level associated with the Logger.

public Iterable<StatusListener>

Returns:

An Iterable for the list of StatusListeners.
getListeners
()

Returns a thread safe Iterable for the StatusListener.

public static StatusLogger

Returns:

The StatusLogger.
getLogger
()

Retrieve the StatusLogger.

private StackTraceElement
getStackTraceElement(final String fqcn, final StackTraceElement[] stackTrace)

public List<StatusData>

Returns:

The list of StatusData objects.
getStatusData
()

Returns a List of all events as StatusData objects.

public boolean
isEnabled(final Level
The logging Level to check.
level
,
final Marker
A Marker or null.
marker
,
final String
The message.
message
,
final Throwable
the exception to log, including its stack trace.
t
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.isEnabled.

Tests if logging is enabled.

public boolean
isEnabled(final Level
The logging Level to check.
level
,
final Marker
A Marker or null.
marker
,
final String
The message.
message
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.isEnabled.

Tests if logging is enabled.

public boolean
isEnabled(final Level
The logging Level to check.
level
,
final Marker
A Marker or null.
marker
,
final String
The message.
message
,
final Object...
The parameters.
params
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.isEnabled.

Tests if logging is enabled.

public boolean
isEnabled(final Level
The logging Level to check.
level
,
final Marker
A Marker or null.
marker
,
final String
The message.
message
,
final Object
the message parameters
p0
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.isEnabled.

Tests if logging is enabled.

public boolean
isEnabled(final Level
The logging Level to check.
level
,
final Marker
A Marker or null.
marker
,
final String
The message.
message
,
final Object
the message parameters
p0
,
final Object
the message parameters
p1
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.isEnabled.

Tests if logging is enabled.

public boolean
isEnabled(final Level
The logging Level to check.
level
,
final Marker
A Marker or null.
marker
,
final String
The message.
message
,
final Object
the message parameters
p0
,
final Object
the message parameters
p1
,
final Object
the message parameters
p2
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.isEnabled.

Tests if logging is enabled.

public boolean
isEnabled(final Level
The logging Level to check.
level
,
final Marker
A Marker or null.
marker
,
final String
The message.
message
,
final Object
the message parameters
p0
,
final Object
the message parameters
p1
,
final Object
the message parameters
p2
,
final Object
the message parameters
p3
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.isEnabled.

Tests if logging is enabled.

public boolean
isEnabled(final Level
The logging Level to check.
level
,
final Marker
A Marker or null.
marker
,
final String
The message.
message
,
final Object
the message parameters
p0
,
final Object
the message parameters
p1
,
final Object
the message parameters
p2
,
final Object
the message parameters
p3
,
final Object
the message parameters
p4
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.isEnabled.

Tests if logging is enabled.

public boolean
isEnabled(final Level
The logging Level to check.
level
,
final Marker
A Marker or null.
marker
,
final String
The message.
message
,
final Object
the message parameters
p0
,
final Object
the message parameters
p1
,
final Object
the message parameters
p2
,
final Object
the message parameters
p3
,
final Object
the message parameters
p4
,
final Object
the message parameters
p5
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.isEnabled.

Tests if logging is enabled.

public boolean
isEnabled(final Level
The logging Level to check.
level
,
final Marker
A Marker or null.
marker
,
final String
The message.
message
,
final Object
the message parameters
p0
,
final Object
the message parameters
p1
,
final Object
the message parameters
p2
,
final Object
the message parameters
p3
,
final Object
the message parameters
p4
,
final Object
the message parameters
p5
,
final Object
the message parameters
p6
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.isEnabled.

Determines if logging is enabled.

public boolean
isEnabled(final Level
The logging Level to check.
level
,
final Marker
A Marker or null.
marker
,
final String
The message.
message
,
final Object
the message parameters
p0
,
final Object
the message parameters
p1
,
final Object
the message parameters
p2
,
final Object
the message parameters
p3
,
final Object
the message parameters
p4
,
final Object
the message parameters
p5
,
final Object
the message parameters
p6
,
final Object
the message parameters
p7
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.isEnabled.

Tests if logging is enabled.

public boolean
isEnabled(final Level
The logging Level to check.
level
,
final Marker
A Marker or null.
marker
,
final String
The message.
message
,
final Object
the message parameters
p0
,
final Object
the message parameters
p1
,
final Object
the message parameters
p2
,
final Object
the message parameters
p3
,
final Object
the message parameters
p4
,
final Object
the message parameters
p5
,
final Object
the message parameters
p6
,
final Object
the message parameters
p7
,
final Object
the message parameters
p8
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.isEnabled.

Tests if logging is enabled.

public boolean
isEnabled(final Level
The logging Level to check.
level
,
final Marker
A Marker or null.
marker
,
final String
The message.
message
,
final Object
the message parameters
p0
,
final Object
the message parameters
p1
,
final Object
the message parameters
p2
,
final Object
the message parameters
p3
,
final Object
the message parameters
p4
,
final Object
the message parameters
p5
,
final Object
the message parameters
p6
,
final Object
the message parameters
p7
,
final Object
the message parameters
p8
,
final Object
the message parameters
p9
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.isEnabled.

Tests if logging is enabled.

public boolean
isEnabled(final Level
The logging Level to check.
level
,
final Marker
A Marker or null.
marker
,
final CharSequence
The message.
message
,
final Throwable
A Throwable.
t
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.isEnabled.

Tests if logging is enabled.

public boolean
isEnabled(final Level
The logging Level to check.
level
,
final Marker
A Marker or null.
marker
,
final Object
The message.
message
,
final Throwable
A Throwable.
t
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.isEnabled.

Tests if logging is enabled.

public boolean
isEnabled(final Level
The logging Level to check.
level
,
final Marker
A Marker or null.
marker
,
final Message
The Message.
message
,
final Throwable
A Throwable.
t
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.isEnabled.

Tests if logging is enabled.

public boolean
isEnabled(final Level
The Level to check
level
,
final Marker
The Marker to check
marker
)

Overrides org.apache.logging.log4j.spi.AbstractLogger.isEnabled.

Implements org.apache.logging.log4j.Logger.isEnabled.

Checks whether this Logger is enabled for the given Level and Marker.

public void
logMessage(final String
The fully qualified class name of the caller
fqcn
,
final Level
The logging level
level
,
final Marker
The Marker
marker
,
final Message
The message associated with the event.
msg
,
final Throwable
A Throwable or null.
t
)

Implements org.apache.logging.log4j.spi.ExtendedLogger.logMessage.

Adds an event.

public void
registerListener(final StatusListener
The StatusListener to register.
listener
)

Registers a new listener.

public void
removeListener(final StatusListener
The StatusListener to remove.
listener
)

Removes a StatusListener.

public void
reset()

Clears the list of status events and listeners.

public void
setLevel(final Level level)

public void
updateListenerLevel(final Level status)

Inherited from org.apache.logging.log4j.spi.AbstractLogger:
alwaysatDebugatErroratFatalatInfoatLevelatTraceatWarncatchingcatchingcatchingcatchingMsgcheckMessageFactorydebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugdebugenterenterenterenterenterentryentryentryentryMsgentryMsgentryMsgerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorerrorexitexitexitexitexitMsgfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalfatalgetFlowMessageFactorygetLogBuildergetMessageFactorygetNamegetRecursionDepthinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoinfoisDebugEnabledisDebugEnabledisEnabledisErrorEnabledisErrorEnabledisFatalEnabledisFatalEnabledisInfoEnabledisInfoEnabledisTraceEnabledisTraceEnabledisWarnEnabledisWarnEnabledloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogloglogIfEnabledlogIfEnabledlogIfEnabledlogIfEnabledlogIfEnabledlogIfEnabledlogIfEnabledlogIfEnabledlogIfEnabledlogIfEnabledlogIfEnabledlogIfEnabledlogIfEnabledlogIfEnabledlogIfEnabledlogIfEnabledlogIfEnabledlogIfEnabledlogIfEnabledlogMessagelogMessagelogMessagelogMessagelogMessagelogMessagelogMessagelogMessagelogMessagelogMessagelogMessagelogMessagelogMessagelogMessagelogMessagelogMessagelogMessagelogMessagelogMessageprintfprintfrequiresLocationthrowingthrowingthrowingthrowingMsgtracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetracetraceEntrytraceEntrytraceEntrytraceEntrytraceEntrytraceExittraceExittraceExittraceExittraceExittraceExitwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarnwarn