org.apache.logging.log4j.core.jmx
Class StatusLoggerAdmin

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.apache.logging.log4j.core.jmx.StatusLoggerAdmin
All Implemented Interfaces:
NotificationBroadcaster, NotificationEmitter, StatusLoggerAdminMBean, StatusListener

public class StatusLoggerAdmin
extends NotificationBroadcasterSupport
implements StatusListener, StatusLoggerAdminMBean

Implementation of the StatusLoggerAdminMBean interface.


Field Summary
 
Fields inherited from interface org.apache.logging.log4j.core.jmx.StatusLoggerAdminMBean
NAME, NOTIF_TYPE_DATA, NOTIF_TYPE_MESSAGE
 
Constructor Summary
StatusLoggerAdmin(Executor executor)
          Constructs a new StatusLoggerAdmin with the Executor to be used for sending Notifications asynchronously to listeners.
 
Method Summary
 String getLevel()
          Returns the StatusLogger level as a String.
 ObjectName getObjectName()
          Returns the ObjectName of this mbean.
 List<StatusData> getStatusData()
          Returns a list with the most recent StatusData objects in the status history.
 String[] getStatusDataHistory()
          Returns a string array with the most recent messages in the status history.
 void log(StatusData data)
           
 void setLevel(String level)
          Sets the StatusLogger level to the specified value.
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatusLoggerAdmin

public StatusLoggerAdmin(Executor executor)
Constructs a new StatusLoggerAdmin with the Executor to be used for sending Notifications asynchronously to listeners.

Parameters:
executor - used to send notifications asynchronously
Method Detail

getStatusDataHistory

public String[] getStatusDataHistory()
Description copied from interface: StatusLoggerAdminMBean
Returns a string array with the most recent messages in the status history. The list has up to 200 entries by default but the length can be configured with system property "log4j2.status.entries".

Specified by:
getStatusDataHistory in interface StatusLoggerAdminMBean
Returns:
the most recent messages logged by the StatusLogger.

getStatusData

public List<StatusData> getStatusData()
Description copied from interface: StatusLoggerAdminMBean
Returns a list with the most recent StatusData objects in the status history. The list has up to 200 entries by default but the length can be configured with system property "log4j2.status.entries".

Note that the returned objects may contain Throwables from external libraries. JMX clients calling this method must be prepared to deal with the errors that occur if they do not have the class definition for such Throwables in their classpath.

Specified by:
getStatusData in interface StatusLoggerAdminMBean
Returns:
the most recent messages logged by the StatusLogger.

getLevel

public String getLevel()
Description copied from interface: StatusLoggerAdminMBean
Returns the StatusLogger level as a String.

Specified by:
getLevel in interface StatusLoggerAdminMBean
Returns:
the StatusLogger level.

setLevel

public void setLevel(String level)
Description copied from interface: StatusLoggerAdminMBean
Sets the StatusLogger level to the specified value.

Specified by:
setLevel in interface StatusLoggerAdminMBean
Parameters:
level - the new StatusLogger level.

log

public void log(StatusData data)
Specified by:
log in interface StatusListener

getObjectName

public ObjectName getObjectName()
Returns the ObjectName of this mbean.

Returns:
the ObjectName
See Also:
StatusLoggerAdminMBean.NAME


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.