org.apache.logging.log4j.status
Class StatusLogger

java.lang.Object
  extended by org.apache.logging.log4j.spi.AbstractLogger
      extended by org.apache.logging.log4j.status.StatusLogger
All Implemented Interfaces:
Serializable, Logger, ExtendedLogger

public final class StatusLogger
extends AbstractLogger

Records events that occur in the logging system.

See Also:
Serialized Form

Field Summary
static String MAX_STATUS_ENTRIES
          System property that can be configured with the number of entries in the queue.
 
Fields inherited from class org.apache.logging.log4j.spi.AbstractLogger
CATCHING_MARKER, DEFAULT_MESSAGE_FACTORY_CLASS, ENTRY_MARKER, EXCEPTION_MARKER, EXIT_MARKER, FLOW_MARKER, THROWING_MARKER
 
Method Summary
 void clear()
          Clears the list of status events.
 Level getLevel()
          Gets the Level associated with the Logger.
 Iterable<StatusListener> getListeners()
          Returns a thread safe Iterable for the StatusListener.
static StatusLogger getLogger()
          Retrieve the StatusLogger.
 List<StatusData> getStatusData()
          Returns a List of all events as StatusData objects.
 boolean isEnabled(Level level, Marker marker)
          Checks whether this logger is enabled at the specified level and an optional Marker.
 boolean isEnabled(Level level, Marker marker, Message message, Throwable t)
          Determines if logging is enabled.
 boolean isEnabled(Level level, Marker marker, Object message, Throwable t)
          Determines if logging is enabled.
 boolean isEnabled(Level level, Marker marker, String message)
          Determine if logging is enabled.
 boolean isEnabled(Level level, Marker marker, String message, Object... params)
          Determines if logging is enabled.
 boolean isEnabled(Level level, Marker marker, String message, Throwable t)
          Determines if logging is enabled.
 void logMessage(String fqcn, Level level, Marker marker, Message msg, Throwable t)
          Adds an event.
 void registerListener(StatusListener listener)
          Registers a new listener.
 void removeListener(StatusListener listener)
          Removes a StatusListener.
 void reset()
          Clears the list of status events and listeners.
 void setLevel(Level level)
           
 
Methods inherited from class org.apache.logging.log4j.spi.AbstractLogger
catching, catching, catching, catchingMsg, checkMessageFactory, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, entry, entry, entry, entryMsg, error, error, error, error, error, error, error, error, error, error, error, error, error, error, exit, exit, exit, exitMsg, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, getMessageFactory, getName, info, info, info, info, info, info, info, info, info, info, info, info, info, info, isDebugEnabled, isDebugEnabled, isEnabled, isErrorEnabled, isErrorEnabled, isFatalEnabled, isFatalEnabled, isInfoEnabled, isInfoEnabled, isTraceEnabled, isTraceEnabled, isWarnEnabled, isWarnEnabled, log, log, log, log, log, log, log, log, log, log, log, log, log, log, logIfEnabled, logIfEnabled, logIfEnabled, logIfEnabled, logIfEnabled, logMessage, logMessage, logMessage, logMessage, printf, printf, throwing, throwing, throwing, throwingMsg, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_STATUS_ENTRIES

public static final String MAX_STATUS_ENTRIES
System property that can be configured with the number of entries in the queue. Once the limit is reached older entries will be removed as new entries are added.

See Also:
Constant Field Values
Method Detail

getLogger

public static StatusLogger getLogger()
Retrieve the StatusLogger.

Returns:
The StatusLogger.

setLevel

public void setLevel(Level level)

registerListener

public void registerListener(StatusListener listener)
Registers a new listener.

Parameters:
listener - The StatusListener to register.

removeListener

public void removeListener(StatusListener listener)
Removes a StatusListener.

Parameters:
listener - The StatusListener to remove.

getListeners

public Iterable<StatusListener> getListeners()
Returns a thread safe Iterable for the StatusListener.

Returns:
An Iterable for the list of StatusListeners.

reset

public void reset()
Clears the list of status events and listeners.


getStatusData

public List<StatusData> getStatusData()
Returns a List of all events as StatusData objects.

Returns:
The list of StatusData objects.

clear

public void clear()
Clears the list of status events.


getLevel

public Level getLevel()
Description copied from interface: Logger
Gets the Level associated with the Logger.

Returns:
the Level associate with the Logger.

logMessage

public void logMessage(String fqcn,
                       Level level,
                       Marker marker,
                       Message msg,
                       Throwable t)
Adds an event.

Parameters:
marker - The Marker
fqcn - The fully qualified class name of the caller
level - The logging level
msg - The message associated with the event.
t - A Throwable or null.

isEnabled

public boolean isEnabled(Level level,
                         Marker marker,
                         String message,
                         Throwable t)
Description copied from interface: ExtendedLogger
Determines if logging is enabled.

Parameters:
level - The logging Level to check.
marker - A Marker or null.
message - The message.
t - the exception to log, including its stack trace.
Returns:
True if logging is enabled, false otherwise.

isEnabled

public boolean isEnabled(Level level,
                         Marker marker,
                         String message)
Description copied from interface: ExtendedLogger
Determine if logging is enabled.

Parameters:
level - The logging Level to check.
marker - A Marker or null.
message - The message.
Returns:
True if logging is enabled, false otherwise.

isEnabled

public boolean isEnabled(Level level,
                         Marker marker,
                         String message,
                         Object... params)
Description copied from interface: ExtendedLogger
Determines if logging is enabled.

Parameters:
level - The logging Level to check.
marker - A Marker or null.
message - The message.
params - The parameters.
Returns:
True if logging is enabled, false otherwise.

isEnabled

public boolean isEnabled(Level level,
                         Marker marker,
                         Object message,
                         Throwable t)
Description copied from interface: ExtendedLogger
Determines if logging is enabled.

Parameters:
level - The logging Level to check.
marker - A Marker or null.
message - The message.
t - A Throwable.
Returns:
True if logging is enabled, false otherwise.

isEnabled

public boolean isEnabled(Level level,
                         Marker marker,
                         Message message,
                         Throwable t)
Description copied from interface: ExtendedLogger
Determines if logging is enabled.

Parameters:
level - The logging Level to check.
marker - A Marker or null.
message - The Message.
t - A Throwable.
Returns:
True if logging is enabled, false otherwise.

isEnabled

public boolean isEnabled(Level level,
                         Marker marker)
Description copied from interface: Logger
Checks whether this logger is enabled at the specified level and an optional Marker.

Specified by:
isEnabled in interface Logger
Overrides:
isEnabled in class AbstractLogger
Parameters:
level - The Level to check.
marker - The marker data specific to this log statement.
Returns:
boolean - true if this Logger is enabled for level WARN, false otherwise.


Copyright © 1999-2015 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.