createAppender("MyFileAppender", "File", new String[] {"filename=myFile.log"}, null);
public interface LoggingManagementMBean
The LoggingManagementMBean
interface provides methods to modify Rhino’s log configuration.
Modifier and Type | Field and Description |
---|---|
static String |
MBEAN_NAME
The name of this MBean, equal to the string "Logging".
|
static String |
OBJECT_NAME
The JMX Object Name of this MBean.
|
Modifier and Type | Method and Description |
---|---|
void |
addAppenderRef(String logKey,
String appenderRef)
Add a log appender to a log key.
|
void |
addComponent(String logKey,
String pluginName,
String[] properties,
CompositeData[] components)
Add a component to a log key.
|
CompositeData |
buildGenericComponent(String pluginName,
String[] properties,
CompositeData[] components)
Build a generic plugin component.
|
void |
createAppender(CompositeData appenderConfig)
Create an appender.
|
void |
createAppender(String name,
String pluginName,
String[] properties,
CompositeData[] components)
Create an appender.
|
void |
createFileAppender(String appenderName,
String filename)
Deprecated.
|
void |
createFileAppender(String appenderName,
String filename,
String processName)
Deprecated.
|
void |
createFileAppender(String appenderName,
String filename,
String maxfilesize,
Integer maxbackups)
Deprecated.
|
void |
createFileAppender(String appenderName,
String filename,
String maxfilesize,
Integer maxbackups,
String processName)
Deprecated.
|
void |
createLogNotificationAppender(String appenderName,
String threshold)
Deprecated.
|
void |
createSocketAppender(String appenderName,
String remoteHost,
int port)
Deprecated.
|
void |
createSocketAppender(String appenderName,
String remoteHost,
int port,
String processName)
Deprecated.
|
void |
createSyslogAppender(String appenderName,
String syslogHost,
String facility)
Deprecated.
|
void |
createSyslogAppender(String appenderName,
String syslogHost,
String facility,
String processName)
Deprecated.
|
boolean |
getAdditivity(String logKey)
Deprecated.
use
getLoggerAdditivity(String) } instead. |
int |
getAlarmLogPeriod()
Get the interval between periodic active alarm logs.
|
CompositeData |
getAppenderInfo(String appenderName)
Get a description of an appender configuration.
|
TabularData |
getAppenderProperties(String appenderName)
Get the configuration properties for an appender.
|
String[] |
getAppenderRefs(String logKey)
Deprecated.
use
getLoggerAppenderRefs(String) instead. |
String[] |
getAppenders()
Get a list of all configured appenders.
|
String |
getAppenderType(String appenderName)
Get the plugin name for an appender.
|
String[] |
getConfiguredLogKeys()
Get a list of all log keys that have some configuration associated with them.
|
CompositeData |
getEffectiveLoggerConfig(String logKey)
Get a description of a log key’s effective configuration.
|
String |
getEffectiveLogLevel(String logKey)
Get the effective log level for a log key, whether or not it has been explicitly set.
|
CompositeData |
getFileAppenderInfo(String appenderName)
Deprecated.
use
getAppenderInfo(String) instead. |
Boolean |
getLoggerAdditivity(String logKey)
Get the configured additivity for a log key.
|
String[] |
getLoggerAppenderRefs(String logKey)
Get the names of the appenders attached to a logger.
|
Boolean |
getLoggerAsynchronous(String logKey)
Get the configured asynchronosity for a log key.
|
CompositeData |
getLoggerConfig(String logKey)
Get a description of a log key’s configuration.
|
String |
getLoggerLevel(String logKey)
Get the configured filter level for a log key.
|
TabularData |
getLoggingProperties()
Get the set of all logging properties.
|
String |
getLoggingProperty(String name)
Get the value of a logging property.
|
String[] |
getLoggingPropertyNames()
Get the set of all known logging properties
|
String[] |
getLogKeys()
Get a list of all known log keys.
|
String |
getLogLevel(String logKey)
Deprecated.
use
getLoggerLevel(String) instead. |
CompositeData |
getSocketAppenderInfo(String appenderName)
Deprecated.
use
getAppenderInfo(String) instead. |
CompositeData |
getSyslogAppenderInfo(String appenderName)
Deprecated.
use
getAppenderInfo(String) instead. |
String |
getThreshold(String appenderName)
Get the log filter level for and appender
Log messages logged at a level below the threshold will not be output.
|
boolean |
isExists(String logKey)
Deprecated.
use
isLoggerExists(String) instead. |
boolean |
isLoggerConfigured(String logKey)
Determine if the log key has any configuration associated with it.
|
boolean |
isLoggerExists(String logKey)
Determine if a logger for the given log key currently exists.
|
void |
removeAppender(String appenderName)
Delete a log appender.
|
void |
removeAppenderRef(String logKey,
String appenderRef)
Remove a log appender from a log key.
|
void |
removeLoggerConfig(String logKey)
Remove a log key configuration.
|
void |
removeLoggingProperty(String name)
Remove a logging property.
|
void |
rollover(String appenderName)
Roll over the log file for a file appender.
|
void |
rolloverAllLogFiles()
Roll over the log files for all file appenders.
|
void |
setAdditivity(String logKey,
boolean additivity)
Deprecated.
use
setLoggerAdditivity(String, Boolean) instead. |
void |
setAlarmLogPeriod(int period)
Set the interval between periodic active alarm logs.
|
void |
setLoggerAdditivity(String logKey,
Boolean additivity)
Set the additivity for a log key.
|
void |
setLoggerAsynchronous(String logKey,
Boolean asynchronous)
Set the asynchronous mode for a log key.
|
boolean |
setLoggerConfig(String logKey,
String level,
Boolean additivity,
Boolean asynchronous,
String[] appenderRefs,
CompositeData[] components)
Create or update a log key’s configuration.
|
void |
setLoggerLevel(String logKey,
String level)
Set the log filter level for a log key.
|
void |
setLoggingProperties(Map<String,String> properties)
Create or update multiple logging properties.
|
void |
setLoggingProperty(String name,
String value)
Create or update a logging property.
|
void |
setLogLevel(String logKey,
String level)
Deprecated.
use
setLoggerLevel(String, String) instead. |
void |
setThreshold(String appenderName,
String threshold)
Sets the log filter level for an appender.
|
void |
updateAppender(CompositeData appenderConfig)
Update an appender.
|
static final String MBEAN_NAME
The name of this MBean, equal to the string "Logging".
static final String OBJECT_NAME
The JMX Object Name of this MBean.
@Deprecated void setLogLevel(String logKey, String level) throws com.opencloud.util.exception.ValidationException, ConfigurationException
setLoggerLevel(String, String)
instead.Set the log filter level for a log key.
logKey
- the log key of the logger, or "root" to update the root logger.level
- the desired log level, or null
to clear a previously set log level.com.opencloud.util.exception.ValidationException
- if a validation error occurs updating the logger configuration.ConfigurationException
- if a error occurred updating the logger configuration.void setLoggerLevel(String logKey, String level) throws com.opencloud.util.exception.ValidationException, ConfigurationException
Set the log filter level for a log key.
logKey
- the log key of the logger, or "root" to update the root logger.level
- the desired log level, or null
to clear a previously set log level.com.opencloud.util.exception.ValidationException
- if a validation error occurs updating the logger configuration.ConfigurationException
- if a error occurred updating the logger configuration.@Deprecated void setAdditivity(String logKey, boolean additivity) throws com.opencloud.util.exception.ValidationException, ConfigurationException
setLoggerAdditivity(String, Boolean)
instead.Set the additivity for a log key.
A logger with additivity enabled propagates log messages sent to it to its parent logger. A logger with additivity disabled suppresses this behaviour.
The default behaviour for loggers is that additivity is enabled.
logKey
- the log key of the logger.additivity
- true
for enabled or false
for disabled.com.opencloud.util.exception.ValidationException
- if a validation error occurs updating the logger configuration.ConfigurationException
- if a error occurred updating the logger configuration.void setLoggerAdditivity(String logKey, Boolean additivity) throws com.opencloud.util.exception.ValidationException, ConfigurationException
Set the additivity for a log key.
A logger with additivity enabled propagates log messages sent to it to its parent logger. A logger with additivity disabled suppresses this behaviour.
The default behaviour for loggers is that additivity is enabled.
logKey
- the log key of the logger.additivity
- true
for enabled, false
for disabled, or null
to use the platform default.com.opencloud.util.exception.ValidationException
- if a validation error occurs updating the logger configuration.ConfigurationException
- if a error occurred updating the logger configuration.void setLoggerAsynchronous(String logKey, Boolean asynchronous) throws com.opencloud.util.exception.ValidationException, ConfigurationException
Set the asynchronous mode for a log key.
logKey
- the log key of the logger, or "root" to update the root logger.asynchronous
- true
for asynchronous, false
for synchronous), or null
to use the platform default.com.opencloud.util.exception.ValidationException
- if a validation error occurs updating the logger configuration.ConfigurationException
- if a error occurred updating the logger configuration.void addComponent(String logKey, String pluginName, String[] properties, CompositeData[] components) throws UnknownAppenderException, com.opencloud.util.exception.ValidationException, ConfigurationException
Add a component to a log key.
logKey
- the log key of the logger, or "root" to update the root logger.pluginName
- the name of the plugin component.properties
- the properties for the plugincomponents
- descriptions of all plugin components that should be associated with this plugin componentUnknownAppenderException
com.opencloud.util.exception.ValidationException
- if a validation error occurs adding the component.ConfigurationException
- if a error occurred adding the component.buildGenericComponent(String, String[], CompositeData[])
void addAppenderRef(String logKey, String appenderRef) throws UnknownAppenderException, com.opencloud.util.exception.ValidationException, ConfigurationException
Add a log appender to a log key.
logKey
- the log key of the logger, or "root" to update the root logger.appenderRef
- the name of the appender.UnknownAppenderException
- if the appender name is not recognised.com.opencloud.util.exception.ValidationException
- if a validation error occurs updating the logger configuration.ConfigurationException
- if a error occurred updating the logger configuration.void removeAppenderRef(String logKey, String appenderRef) throws UnknownAppenderException, ConfigurationException
Remove a log appender from a log key.
logKey
- the log key of the logger, or "root" to update the root logger.appenderRef
- the name of the appender.UnknownAppenderException
- if the appender name is not recognised.ConfigurationException
- if a error occurred updating the logger configuration.void removeAppender(String appenderName) throws UnknownAppenderException, ConfigurationException
Delete a log appender.
appenderName
- the name of the appender to delete.UnknownAppenderException
- if the appender name is not recognised.ConfigurationException
- if a error occurred removing the appender.void setThreshold(String appenderName, String threshold) throws com.opencloud.util.exception.ValidationException, ConfigurationException
Sets the log filter level for an appender.
Log messages logged at a level below the threshold will not be output.
Setting the threshold to null
will unset any previously set appender threshold.
appenderName
- the name of the appender to reference.threshold
- the log level, or null
to unset the threshold.com.opencloud.util.exception.ValidationException
- if a validation error occurs updating the appender configuration.ConfigurationException
- if a error occurred updating the appender configuration.@Deprecated void createFileAppender(String appenderName, String filename) throws ConfigurationException
createAppender(String, String, String[], CompositeData[])
insteadCreates a rolling log file appender. The maximum file size and backup count will be set to Rhino defaults.
appenderName
- the name the appender is referenced byfilename
- the target of the appenders log messagesConfigurationException
- if a error occurred creating the appender.@Deprecated void createFileAppender(String appenderName, String filename, String processName) throws ConfigurationException
createAppender(String, String, String[], CompositeData[])
insteadCreates a rolling log file appender. The maximum file size and backup count will be set to Rhino defaults.
appenderName
- the name the appender is referenced byfilename
- the target of the appenders log messagesprocessName
- This argument is ignoredConfigurationException
- if a error occurred creating the appender.@Deprecated void createFileAppender(String appenderName, String filename, String maxfilesize, Integer maxbackups) throws ConfigurationException
createAppender(String, String, String[], CompositeData[])
insteadCreates a rolling log file appender.
appenderName
- the name the appender is referenced byfilename
- the target of the appenders log messagesmaxfilesize
- the maximum size before rollovermaxbackups
- the maximum number of rolloversConfigurationException
- if a error occurred creating the appender.@Deprecated void createFileAppender(String appenderName, String filename, String maxfilesize, Integer maxbackups, String processName) throws ConfigurationException
createAppender(String, String, String[], CompositeData[])
insteadCreates a rolling log file appender.
appenderName
- the name the appender is referenced byfilename
- the target of the appenders log messagesmaxfilesize
- the maximum size before rollovermaxbackups
- the maximum number of rolloversprocessName
- This argument is ignoredConfigurationException
- if a error occurred creating the appender.@Deprecated void createSocketAppender(String appenderName, String remoteHost, int port) throws ConfigurationException
createAppender(String, String, String[], CompositeData[])
insteadCreates a log4j socket appender.
appenderName
- the name the appender is referenced byremoteHost
- the host to connect toport
- the port to connect toConfigurationException
- if a error occurred creating the appender.@Deprecated void createSocketAppender(String appenderName, String remoteHost, int port, String processName) throws ConfigurationException
createAppender(String, String, String[], CompositeData[])
insteadCreates a log4j socket appender.
appenderName
- the name the appender is referenced byremoteHost
- the host to connect toport
- the port to connect toprocessName
- This argument is ignoredConfigurationException
- if a error occurred creating the appender.@Deprecated void createSyslogAppender(String appenderName, String syslogHost, String facility) throws ConfigurationException
createAppender(String, String, String[], CompositeData[])
insteadCreate a syslog appender.
appenderName
- the name the appender is referenced bysyslogHost
- the syslog hostfacility
- the syslog facility log message targetConfigurationException
- if a error occurred creating the appender.@Deprecated void createSyslogAppender(String appenderName, String syslogHost, String facility, String processName) throws ConfigurationException
createAppender(String, String, String[], CompositeData[])
insteadCreate a syslog appender.
appenderName
- the name the appender is referenced bysyslogHost
- the syslog hostfacility
- the syslog facility log message targetprocessName
- This argument is ignoredConfigurationException
- if a error occurred creating the appender.@Deprecated void createLogNotificationAppender(String appenderName, String threshold) throws ConfigurationException
createAppender(String, String, String[], CompositeData[])
insteadCreate a LogNotification appender.
appenderName
- the name the appender is referenced byConfigurationException
- if a error occurred creating the appender.void rollover(String appenderName) throws NullPointerException, UnknownAppenderException, ConfigurationException
Roll over the log file for a file appender. A backup of the log file is created and then the log file truncated.
appenderName
- the name of the appender.NullPointerException
- if appenderName
is null
.UnknownAppenderException
- if an appender with the specified name does not exist or is not a rolling file appender.ConfigurationException
- if a error occurred rolling the appender.void rolloverAllLogFiles() throws ConfigurationException
Roll over the log files for all file appenders. A backup of the each log file is created and then the log file truncated.
ConfigurationException
- if a error occurred rolling the appenders.CompositeData getLoggerConfig(String logKey) throws NullPointerException, LoggerNotConfiguredException, ConfigurationException, ManagementException
Get a description of a log key’s configuration.
The CompositeData
object returned by this method has the following structure:
Field | Open Type | Description |
---|---|---|
name |
String |
The name (ie. log key) of the logging configuration. |
log-level |
String |
The log filter level assigned to the logger, if any. |
additivity |
Boolean |
Indicator of logger additivity, if configured. |
asynchronous |
Boolean |
Indicator of logger asynchronosity, if configured. |
appender-refs |
String[] |
The names of the appenders attached to the logger. |
plugin-refs |
String[] |
The names of the plugin components directly attached to the logger. |
plugins |
CompositeData[] |
[multiblock cell omitted] |
Each plugin description is expressed as a CompositeData
object with the following structure:
Field | Open Type | Description |
---|---|---|
pluginName |
String |
The name of the plugin component. |
properties |
CompositeData[] |
Descriptions of configuration properties provided to the plugin component. The format of this composite data is given below. |
componentType |
CompositeData[] |
[multiblock cell omitted] |
Each plugin configuration property is expressed as a CompositeData
object with the following structure:
Field | Open Type | Description |
---|---|---|
name |
String |
The name of the configuration property. |
value |
String |
The value given to the configuration property. |
logKey
- the log key of the logger.CompositeData
as given in the method description.NullPointerException
- if logKey
is null
.LoggerNotConfiguredException
- if a logger for the specified log key is not configured.ConfigurationException
- if a error occurred reading the logger configuration.ManagementException
- if the logger configuration could not be returned due to an internal error.CompositeData getEffectiveLoggerConfig(String logKey) throws NullPointerException, ManagementException
Get a description of a log key’s effective configuration.
The CompositeData
object returned by this method has the following structure:
Field | Open Type | Description |
---|---|---|
name |
String |
The name (ie. log key) of the logging configuration. |
log-level |
String |
The log level assigned to the logger, if any. |
additivity |
Boolean |
Indicator of logger additivity. |
asynchronous |
Boolean |
Indicator of logger asynchronosity. |
appender-refs |
String[] |
The names of the appenders attached to the logger. |
logKey
- the log key of the logger.CompositeData
as given in the method description.NullPointerException
- if logKey
is null
.ManagementException
- if the logger configuration could not be returned due to an internal error.boolean setLoggerConfig(String logKey, String level, Boolean additivity, Boolean asynchronous, String[] appenderRefs, CompositeData[] components) throws NullPointerException, com.opencloud.util.exception.ValidationException, ConfigurationException
Create or update a log key’s configuration.
If this method is used to update the configuration for log key that already has a configuration, it completely replaces that configuration with the arguments passed to this method. That is, it does not just update parameters where non-null values are passed in but completely empties out the existing configuration before applying the new parameters.
logKey
- the log key of the logger.level
- the log level to assign to the logger.
May be null
if no level should be assigned.additivity
- the additivity of the logger.
May be null
if the default additivity should be used for the logger.asynchronous
- the asynchronosity of the logger.
May be null
if the default asynchronosity should be used for the logger.appenderRefs
- the names of the appenders that should be attached to the logger.
May be null
.components
- descriptions of plugin components that should be associated with the logger.
Appropriate CompositeData
objects can be created using buildGenericComponent(java.lang.String, java.lang.String[], javax.management.openmbean.CompositeData[])
. May be null
.true
if the logger configuration was successfully created, or false
if the resulting configuration was equivalent to the default empty configuration and consequently deemed unnecessary and discarded.
A discarded configuration means the log key will no longer appear as "configured".NullPointerException
- if logKey
is null
.com.opencloud.util.exception.ValidationException
- if the logger configuration fails a basic validation check.ConfigurationException
- if an error occurs configuring the logger.buildGenericComponent(String, String[], CompositeData[])
void removeLoggerConfig(String logKey) throws NullPointerException, LoggerNotConfiguredException, ConfigurationException
Remove a log key configuration.
logKey
- the log key of the logger.NullPointerException
- if logKey
is null
.LoggerNotConfiguredException
- if a logger for the specified log key is not configured.ConfigurationException
- if an error occurs removing the logger configuration.@Deprecated boolean getAdditivity(String logKey)
getLoggerAdditivity(String)
} instead.Get the additivity of a log key.
logKey
- the log key of the loggertrue
if enabled or false
if disabled.
If the logger is not configured then the default platform additivity (true
is returned.Boolean getLoggerAdditivity(String logKey) throws NullPointerException, LoggerNotConfiguredException, ConfigurationException
Get the configured additivity for a log key.
If the specified log key does not have this setting configured, this method returns null
.
logKey
- the log key of the logger, or "root" to query the root loggertrue
means enabled and false
means disabled.NullPointerException
- if logKey
is null
.LoggerNotConfiguredException
- if a logger for the specified log key is not configured.ConfigurationException
- if a error occurred reading the logger configuration.Boolean getLoggerAsynchronous(String logKey) throws NullPointerException, LoggerNotConfiguredException, ConfigurationException
Get the configured asynchronosity for a log key.
If the specified logger does not have this setting configured, this method returns null
. Return if a logger is asynchronous.
logKey
- the log key of the logger, or "root" to query the root loggertrue
means asynchronous and false
means synchronous.NullPointerException
- if logKey
is null
.LoggerNotConfiguredException
- if a logger for the specified log key is not configured.ConfigurationException
- if a error occurred reading the logger configuration.String getEffectiveLogLevel(String logKey)
Get the effective log level for a log key, whether or not it has been explicitly set. If the specified log key does not have its own level configured, this method returns the level used for the log key based on its ancestors.
logKey
- the log key of the logger, or "root" to query the root logger@Deprecated String getLogLevel(String logKey)
getLoggerLevel(String)
instead.Get the filter log level for a log key.
This does not take inherited levels into account and the return value may be null
.
logKey
- the log key of the logger.String getLoggerLevel(String logKey) throws NullPointerException, LoggerNotConfiguredException, ConfigurationException
Get the configured filter level for a log key.
If the specified logger does not have this setting configured, this method returns null
.
logKey
- the log key of the logger, or "root" to query the root loggerNullPointerException
- if logKey
is null
.LoggerNotConfiguredException
- if a logger for the specified log key is not configured.ConfigurationException
- if a error occurred reading the logger configuration.String[] getLogKeys()
Get a list of all known log keys. This does include the implicit log key "root".
String[] getConfiguredLogKeys() throws ConfigurationException
Get a list of all log keys that have some configuration associated with them.
ConfigurationException
- if a error occurred reading the logger configuration.@Deprecated String[] getAppenderRefs(String logKey) throws ConfigurationException
getLoggerAppenderRefs(String)
instead.Get the names of the appenders attached to a log key.
logKey
- the log key of the logger, or "root" to query the root loggerConfigurationException
- if a error occurred reading the logger configuration.String[] getLoggerAppenderRefs(String logKey) throws NullPointerException, LoggerNotConfiguredException, ConfigurationException
Get the names of the appenders attached to a logger.
logKey
- the log key of the logger, or "root" to query the root loggerNullPointerException
- if logKey
is null
.LoggerNotConfiguredException
- if a logger for the specified log key is not configured.ConfigurationException
- if a error occurred reading the logger configuration.@Deprecated boolean isExists(String logKey)
isLoggerExists(String)
instead.Determine if a logger for the given log key currently exists.
logKey
- the log key of the loggertrue
if a logger exists, false
otherwise.boolean isLoggerExists(String logKey)
Determine if a logger for the given log key currently exists.
logKey
- the log key of the loggertrue
if a logger exists, false
otherwise.boolean isLoggerConfigured(String logKey) throws NullPointerException, ConfigurationException
Determine if the log key has any configuration associated with it.
logKey
- the log key of the loggertrue
if configuration exists, false
otherwise.NullPointerException
- if logKey
is null
.ConfigurationException
- if an error occurs reading the logger configuration.setLoggerConfig(String, String, Boolean, Boolean, String[], CompositeData[])
String[] getAppenders() throws ConfigurationException
Get a list of all configured appenders.
ConfigurationException
- if a error occurred reading the appender configuration.String getAppenderType(String appenderName) throws UnknownAppenderException, ConfigurationException
Get the plugin name for an appender.
Further information on an appender’s configuration is available using getAppenderInfo(String)
.
appenderName
- the name of the appender.UnknownAppenderException
- if the appender name is not recognised.ConfigurationException
- if a error occurred reading the appender configuration.CompositeData getAppenderInfo(String appenderName) throws UnknownAppenderException, ConfigurationException
Get a description of an appender configuration.
The CompositeData
object returned by this method has the following structure:
Field | Open Type | Description |
---|---|---|
pluginName |
String |
The name of the plugin component. |
properties |
CompositeData[] |
Descriptions of configuration properties provided to the plugin component. The format of this composite data is given below. |
componentType |
CompositeData[] |
[multiblock cell omitted] |
Each plugin configuration property is expressed as a CompositeData
object with the following structure:
Field | Open Type | Description |
---|---|---|
name |
String |
The name of the configuration property. |
value |
String |
The value given to the configuration property. |
appenderName
- the name of the appender.UnknownAppenderException
- if the appender name is not recognised.ConfigurationException
- if a error occurred reading the appender configuration.@Deprecated CompositeData getFileAppenderInfo(String appenderName) throws UnknownAppenderException, com.opencloud.util.exception.ValidationException, ConfigurationException
getAppenderInfo(String)
instead.Get a description of a file appender’s configuration.
The returned CompositeData contains three columns:
a java.lang.String column "filename"
a java.lang.String column "maximum-file-size"
a java.lang.Integer column "maximum-backup-files"
appenderName
- the name of the appender.UnknownAppenderException
- if the appender name is not recognised.com.opencloud.util.exception.ValidationException
- if a validation error occurs, for example if the given appender isn’t of the correct type.ConfigurationException
- if a error occurred reading the appender configuration.@Deprecated CompositeData getSocketAppenderInfo(String appenderName) throws UnknownAppenderException, com.opencloud.util.exception.ValidationException, ConfigurationException
getAppenderInfo(String)
instead.Get a description of a socket appender’s configuration.
The returned CompositeData contains two columns:
a java.lang.String column "remote-host"
a java.lang.Integer column "port"
appenderName
- the name of the appender.UnknownAppenderException
- if the appender name is not recognised.com.opencloud.util.exception.ValidationException
- if a validation error occurs, for example if the given appender isn’t of the correct type.ConfigurationException
- if a error occurred reading the appender configuration.@Deprecated CompositeData getSyslogAppenderInfo(String appenderName) throws UnknownAppenderException, com.opencloud.util.exception.ValidationException, ConfigurationException
getAppenderInfo(String)
instead.Get a description of a syslog appender’s configuration.
The returned CompositeData contains two columns:
a java.lang.String columns "syslog-host"
a java.lang.String column "facility"
appenderName
- the name of the appender.UnknownAppenderException
- if the appender name is not recognised.com.opencloud.util.exception.ValidationException
- if a validation error occurs, for example if the given appender isn’t of the correct type.ConfigurationException
- if a error occurred reading the appender configuration.TabularData getAppenderProperties(String appenderName) throws UnknownAppenderException, ConfigurationException
Get the configuration properties for an appender.
The returned TabularData contains a CompositeData row for each property. The CompositeData contains two columns:
a java.lang.String column "name"
a java.lang.String column "value"
appenderName
- the name of the appender to referenceUnknownAppenderException
- if the appender name is not recognised.ConfigurationException
- if a error occurred reading the appender configuration.String getThreshold(String appenderName) throws UnknownAppenderException, ConfigurationException
Get the log filter level for and appender
Log messages logged at a level below the threshold will not be output.
appenderName
- the name of the appender.null
if a threshold is not configured for the appender.UnknownAppenderException
- if the appender name is not recognised.ConfigurationException
- if a error occurred reading the appender configuration.void setAlarmLogPeriod(int period) throws IllegalArgumentException, ConfigurationException
Set the interval between periodic active alarm logs.
Setting the period to 0 will disable periodic alarm logging.
period
- the interval between active alarm logging, measured in seconds.IllegalArgumentException
- if the specified period is less than 0 seconds.ConfigurationException
- if an error occurs updating the logging configuration.int getAlarmLogPeriod() throws ConfigurationException
Get the interval between periodic active alarm logs.
ConfigurationException
- if an error occurs reading the logging configuration.void createAppender(String name, String pluginName, String[] properties, CompositeData[] components) throws com.opencloud.util.exception.ValidationException, ConfigurationException
Create an appender.
For example to create a simple file appender:
createAppender("MyFileAppender", "File", new String[] {"filename=myFile.log"}, null);
name
- The name of the appender.pluginName
- the plugin name for the appender.properties
- The properties specified "name=value" strings in an Array.components
- Additional components required by this component.com.opencloud.util.exception.ValidationException
- if a validation error occurs, for example if the properties are incorrectly specified.ConfigurationException
- if an error occurs creating the appender.buildGenericComponent(String, String[], CompositeData[])
void createAppender(CompositeData appenderConfig) throws com.opencloud.util.exception.ValidationException, ConfigurationException
Create an appender.
appenderConfig
- the full appender configuration.com.opencloud.util.exception.ValidationException
- if a validation error occurs creating the appender.ConfigurationException
- if an error occurs creating the appender.buildGenericComponent(String, String[], CompositeData[])
void updateAppender(CompositeData appenderConfig) throws com.opencloud.util.exception.ValidationException, ConfigurationException
Update an appender.
appenderConfig
- the full appender configuration.com.opencloud.util.exception.ValidationException
- if a validation error occurs updating the appender.ConfigurationException
- if an error occurs updating the appender.buildGenericComponent(String, String[], CompositeData[])
CompositeData buildGenericComponent(String pluginName, String[] properties, CompositeData[] components) throws ConfigurationException
Build a generic plugin component. This is used to construct any Log4j 2 plugin, for example filters or layouts.
For example to create a simple pattern layout:
buildGenericComponent("PatternLayout", new String[] {"pattern=%d %highlight{%p} %style{%C{1.} [%t] %m}{bold,green}%n"}, null);
pluginName
- the name of the plugin.properties
- the properties specified "name=value" strings in an Array.components
- additional components required by this component.ConfigurationException
- if an error occurs creating the component.String[] getLoggingPropertyNames() throws ConfigurationException
Get the set of all known logging properties
ConfigurationException
- if an error occurs reading the logging configuration.String getLoggingProperty(String name) throws UnrecognizedLoggingPropertyException, ConfigurationException
Get the value of a logging property.
name
- the logging property name.UnrecognizedLoggingPropertyException
- if the named logging property does not exist.ConfigurationException
- if an error occurs reading the logging configuration.TabularData getLoggingProperties() throws ConfigurationException
Get the set of all logging properties.
The tabular data returned by this method contains CompositeData
wth the following structure:
Field | Open Type | Description |
---|---|---|
name |
String |
The property name. |
value |
String |
The property’s value. |
ConfigurationException
- if an error occurs reading the logging configuration.void setLoggingProperty(String name, String value) throws ConfigurationException
Create or update a logging property. If the property already exists then its value will be replaced with the new value.
name
- the property name.value
- the property’s value.ConfigurationException
- if an error occurs updating the logging configuration.void setLoggingProperties(Map<String,String> properties) throws ConfigurationException
Create or update multiple logging properties. If any property already exists then its value will be replaced with the new value.
properties
- a map of property name to property value.ConfigurationException
- if an error occurs updating the logging configuration.void removeLoggingProperty(String name) throws UnrecognizedLoggingPropertyException, ConfigurationException
Remove a logging property.
name
- name of the property to remove.UnrecognizedLoggingPropertyException
- if the named logging property does not exist.ConfigurationException
- if the property is in use and cannot be removed.