Class StatusLoggerAdmin
java.lang.Object
javax.management.NotificationBroadcasterSupport
org.apache.logging.log4j.core.jmx.StatusLoggerAdmin
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- EventListener,- MBeanRegistration,- NotificationBroadcaster,- NotificationEmitter,- StatusLoggerAdminMBean,- StatusListener
public class StatusLoggerAdmin
extends NotificationBroadcasterSupport
implements StatusListener, StatusLoggerAdminMBean, MBeanRegistration
Implementation of the 
StatusLoggerAdminMBean interface.- 
Field SummaryFields inherited from interface org.apache.logging.log4j.core.jmx.StatusLoggerAdminMBeanNOTIF_TYPE_DATA, NOTIF_TYPE_MESSAGE, PATTERN
- 
Constructor SummaryConstructorsConstructorDescriptionStatusLoggerAdmin(String contextName, Executor executor) Constructs a newStatusLoggerAdminwith theExecutorto be used for sendingNotifications asynchronously to listeners.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) voidclose()Returns the name of the LoggerContext that theStatusLoggeris associated with.getLevel()Returns theStatusLoggerlevel as a String.Returns theObjectNameof this mbean.Returns a list with the most recentStatusDataobjects in the status history.String[]Returns a string array with the most recent messages in the status history.voidlog(StatusData data) voidvoidpostRegister(Boolean registrationDone) voidpreRegister(MBeanServer server, ObjectName name) voidSets theStatusLoggerlevel to the specified value.Methods inherited from class javax.management.NotificationBroadcasterSupportgetNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
- 
Constructor Details- 
StatusLoggerAdminConstructs a newStatusLoggerAdminwith theExecutorto be used for sendingNotifications asynchronously to listeners.- Parameters:
- contextName- name of the LoggerContext under which to register this StatusLoggerAdmin. Note that the StatusLogger may be registered multiple times, once for each LoggerContext. In web containers, each web application has its own LoggerContext and by associating the StatusLogger with the LoggerContext, all associated MBeans can be unloaded when the web application is undeployed.
- executor- used to send notifications asynchronously
 
 
- 
- 
Method Details- 
addNotificationListenerpublic void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) - Specified by:
- addNotificationListenerin interface- NotificationBroadcaster
- Overrides:
- addNotificationListenerin class- NotificationBroadcasterSupport
 
- 
preRegister- Specified by:
- preRegisterin interface- MBeanRegistration
 
- 
postRegister- Specified by:
- postRegisterin interface- MBeanRegistration
 
- 
preDeregisterpublic void preDeregister()- Specified by:
- preDeregisterin interface- MBeanRegistration
 
- 
postDeregisterpublic void postDeregister()- Specified by:
- postDeregisterin interface- MBeanRegistration
 
- 
getStatusDataHistoryDescription copied from interface:StatusLoggerAdminMBeanReturns 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:
- getStatusDataHistoryin interface- StatusLoggerAdminMBean
- Returns:
- the most recent messages logged by the StatusLogger.
 
- 
getStatusDataDescription copied from interface:StatusLoggerAdminMBeanReturns a list with the most recentStatusDataobjects 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:
- getStatusDatain interface- StatusLoggerAdminMBean
- Returns:
- the most recent messages logged by the StatusLogger.
 
- 
getLevelDescription copied from interface:StatusLoggerAdminMBeanReturns theStatusLoggerlevel as a String.- Specified by:
- getLevelin interface- StatusLoggerAdminMBean
- Returns:
- the StatusLoggerlevel.
 
- 
getStatusLevel- Specified by:
- getStatusLevelin interface- StatusListener
 
- 
setLevelDescription copied from interface:StatusLoggerAdminMBeanSets theStatusLoggerlevel to the specified value.- Specified by:
- setLevelin interface- StatusLoggerAdminMBean
- Parameters:
- level- the new- StatusLoggerlevel.
 
- 
getContextNameDescription copied from interface:StatusLoggerAdminMBeanReturns the name of the LoggerContext that theStatusLoggeris associated with.- Specified by:
- getContextNamein interface- StatusLoggerAdminMBean
- Returns:
- logger context name
 
- 
log- Specified by:
- login interface- StatusListener
 
- 
getObjectNameReturns theObjectNameof this mbean.- Specified by:
- getObjectNamein interface- StatusLoggerAdminMBean
- Returns:
- the ObjectName
- See Also:
 
- 
close- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException
 
 
-