Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

    java.lang.Object
      javax.management.NotificationBroadcasterSupport
          org.apache.logging.log4j.core.jmx.StatusLoggerAdmin

All Implemented Interfaces:
  Closeable, EventListener, NotificationBroadcaster, NotificationEmitter, StatusLoggerAdminMBean, org.apache.logging.log4j.status.StatusListener

    public class StatusLoggerAdmin

extends NotificationBroadcasterSupport
implements org.apache.logging.log4j.status.StatusListener, StatusLoggerAdminMBean

Implementation of the `StatusLoggerAdminMBean` interface.

Field Summary

Fields inherited from interface org.apache.logging.log4j.core.jmx.StatusLoggerAdminMBean
`NOTIF_TYPE_DATA, NOTIF_TYPE_MESSAGE, PATTERN`

Constructor Summary
`StatusLoggerAdmin(String contextName, Executor executor)` Constructs a new `StatusLoggerAdmin` with the `Executor` to be used for sending `Notification`s asynchronously to listeners.

Method Summary
`void` | `close()`
`String` | `getContextName()` Returns the name of the LoggerContext that the `StatusLogger` is associated with.
`String` | `getLevel()` Returns the `StatusLogger` level as a String.
`ObjectName` | `getObjectName()` Returns the `ObjectName` of this mbean.
`List<org.apache.logging.log4j.status.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.
`org.apache.logging.log4j.Level` | `getStatusLevel()`
`void` | `log(org.apache.logging.log4j.status.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(String contextName,
                             Executor executor)

  Constructs a new `StatusLoggerAdmin` with the `Executor` to be used for sending `Notification`s 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 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<org.apache.logging.log4j.status.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 `Throwable`s 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 `Throwable`s 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.

### getStatusLevel

    public org.apache.logging.log4j.Level getStatusLevel()

  Specified by:
    `getStatusLevel` in interface `org.apache.logging.log4j.status.StatusListener`

### 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.

### getContextName

    public String getContextName()

  Description copied from interface: `StatusLoggerAdminMBean`
  Returns the name of the LoggerContext that the `StatusLogger` is associated with.

  Specified by:
    `getContextName` in interface `StatusLoggerAdminMBean`
  Returns:
    logger context name

### log

    public void log(org.apache.logging.log4j.status.StatusData data)

  Specified by:
    `log` in interface `org.apache.logging.log4j.status.StatusListener`

### getObjectName

    public ObjectName getObjectName()

  Returns the `ObjectName` of this mbean.

  Specified by:
    `getObjectName` in interface `StatusLoggerAdminMBean`
  Returns:
    the `ObjectName`
  See Also:
    `StatusLoggerAdminMBean.PATTERN`

### close

    public void close()
               throws IOException

  Specified by:
    `close` in interface `Closeable`
  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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.