public interface StatusLoggerAdminMBean
StatusLogger
.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NOTIF_TYPE_DATA
Notifications with this type have a
StatusData userData object
and a null message. |
static java.lang.String |
NOTIF_TYPE_MESSAGE
Notifications with this type have a formatted status data message string
but no
StatusData in their userData field. |
static java.lang.String |
PATTERN
ObjectName pattern ("org.apache.logging.log4j2:type=%s,component=StatusLogger") for StatusLoggerAdmin MBeans.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getContextName()
Returns the name of the LoggerContext that the
StatusLogger is associated with. |
java.lang.String |
getLevel()
Returns the
StatusLogger level as a String. |
javax.management.ObjectName |
getObjectName()
Returns the
ObjectName that this status logger mbean is registered with. |
java.util.List<StatusData> |
getStatusData()
Returns a list with the most recent
StatusData objects in the
status history. |
java.lang.String[] |
getStatusDataHistory()
Returns a string array with the most recent messages in the status
history.
|
void |
setLevel(java.lang.String level)
Sets the
StatusLogger level to the specified value. |
static final java.lang.String PATTERN
You can find all registered StatusLoggerAdmin MBeans like this:
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); String pattern = String.format(StatusLoggerAdminMBean.PATTERN, "*"); Set<ObjectName> statusLoggerNames = mbs.queryNames(new ObjectName(pattern), null);
Some characters are not allowed in ObjectNames. The logger context name may be quoted. When StatusLoggerAdmin MBeans are registered, their ObjectNames are created using this pattern as follows:
String ctxName = Server.escape(loggerContext.getName()); String name = String.format(PATTERN, ctxName); ObjectName objectName = new ObjectName(name);
Server.escape(String)
,
Constant Field Valuesstatic final java.lang.String NOTIF_TYPE_DATA
StatusData
userData object
and a null
message.static final java.lang.String NOTIF_TYPE_MESSAGE
StatusData
in their userData field.javax.management.ObjectName getObjectName()
ObjectName
that this status logger mbean is registered with.java.util.List<StatusData> getStatusData()
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.
StatusLogger
.java.lang.String[] getStatusDataHistory()
"log4j2.status.entries"
.StatusLogger
.java.lang.String getLevel()
StatusLogger
level as a String.StatusLogger
level.void setLevel(java.lang.String level)
StatusLogger
level to the specified value.level
- the new StatusLogger
level.java.lang.IllegalArgumentException
- if the specified level is not one of
"OFF", "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE",
"ALL"java.lang.String getContextName()
StatusLogger
is associated with.