public interface LoggerContextAdminMBean
LoggerContext.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
NOTIF_TYPE_RECONFIGURED
Notification that the
Configuration of the instrumented
LoggerContext has been reconfigured. |
static java.lang.String |
PATTERN
ObjectName pattern ("org.apache.logging.log4j2:type=%s" ) for LoggerContextAdmin MBeans.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getConfigClassName()
Returns the class name of the
Configuration of the instrumented
LoggerContext. |
java.lang.String |
getConfigFilter()
Returns a string description of all Filters configured in the
Configuration of the instrumented LoggerContext. |
java.lang.String |
getConfigLocationUri()
Returns the configuration location URI as a String.
|
java.lang.String |
getConfigName()
Returns the name of the Configuration of the instrumented LoggerContext.
|
java.util.Map<java.lang.String,java.lang.String> |
getConfigProperties()
Returns a map with configured properties.
|
java.lang.String |
getConfigText()
Returns the configuration text, which may be the contents of the
configuration file or the text that was last set with a call to
setConfigText. |
java.lang.String |
getConfigText(java.lang.String charsetName)
Returns the configuration text, which may be the contents of the
configuration file or the text that was last set with a call to
setConfigText. |
java.lang.String |
getName()
Returns the name of the instrumented
LoggerContext. |
javax.management.ObjectName |
getObjectName()
Returns the
ObjectName that this MBean is registered with in the
MBean server. |
java.lang.String |
getStatus()
Returns the status of the instrumented
LoggerContext. |
void |
setConfigLocationUri(java.lang.String configLocation)
Sets the configuration location to the specified URI.
|
void |
setConfigText(java.lang.String configText,
java.lang.String charsetName)
Sets the configuration text.
|
static final java.lang.String PATTERN
You can find all registered LoggerContextAdmin MBeans like this:
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); String pattern = String.format(LoggerContextAdminMBean.PATTERN, "*"); Set<ObjectName> loggerContextNames = mbs.queryNames(new ObjectName(pattern), null);
Some characters are not allowed in ObjectNames. The logger context name may be quoted. When LoggerContextAdmin 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_RECONFIGURED
Configuration of the instrumented
LoggerContext has been reconfigured. Notifications of this type
("com.apache.logging.log4j.core.jmx.config.reconfigured" ) do not carry a message or user data.javax.management.ObjectName getObjectName()
ObjectName that this MBean is registered with in the
MBean server.java.lang.String getStatus()
LoggerContext.java.lang.String getName()
LoggerContext.LoggerContext.java.lang.String getConfigLocationUri()
void setConfigLocationUri(java.lang.String configLocation)
throws java.net.URISyntaxException,
java.io.IOException
LoggerContext to reconfigure.configLocation - location of the configuration file in
URI format.java.net.URISyntaxException - if the format of the specified
configLocationURI is incorrectjava.io.IOException - if an error occurred reading the specified locationjava.lang.String getConfigText()
throws java.io.IOException
setConfigText. If reading a file, this method assumes the file's
character encoding is UTF-8.java.io.IOException - if a problem occurred reading the contents of the
config file.java.lang.String getConfigText(java.lang.String charsetName)
throws java.io.IOException
setConfigText.charsetName - the encoding to use to convert the file's bytes into
the resulting string.java.io.IOException - if a problem occurred reading the contents of the
config file.void setConfigText(java.lang.String configText,
java.lang.String charsetName)
LoggerContext to be reconfigured with the specified text.configText - the configuration text in XML or JSON formatcharsetName - name of the Charset used to convert the
specified configText to bytesjava.lang.IllegalArgumentException - if a problem occurs configuring from the
specified textjava.lang.String getConfigName()
java.lang.String getConfigClassName()
Configuration of the instrumented
LoggerContext.Configuration.java.lang.String getConfigFilter()
Configuration of the instrumented LoggerContext.java.util.Map<java.lang.String,java.lang.String> getConfigProperties()