createAppender("MyFileAppender", "File", new String[] {"filename=myFile.log"}, null);
Interface LoggingManagementMBean
-
public interface LoggingManagementMBean
The
LoggingManagementMBean
interface provides methods to modify Rhino’s log configuration.
-
-
Field Summary
Fields Modifier and Type Field 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.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method 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(String name, String pluginName, String[] properties, CompositeData[] components)
Create an appender.void
createAppender(CompositeData appenderConfig)
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.usegetLoggerAdditivity(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.usegetLoggerAppenderRefs(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.usegetAppenderInfo(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.String[]
getLoggersReferencingAppender(String appender)
Get the names of all loggers that reference an appender.Map<String,String>
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 propertiesString[]
getLogKeys()
Get a list of all known log keys.String
getLogLevel(String logKey)
Deprecated.usegetLoggerLevel(String)
instead.CompositeData
getSocketAppenderInfo(String appenderName)
Deprecated.usegetAppenderInfo(String)
instead.CompositeData
getSyslogAppenderInfo(String appenderName)
Deprecated.usegetAppenderInfo(String)
instead.String
getThreshold(String appenderName)
Get the log filter level for and appenderboolean
isExists(String logKey)
Deprecated.useisLoggerExists(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.usesetLoggerAdditivity(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.usesetLoggerLevel(String, String)
instead.void
setThreshold(String appenderName, String threshold)
Sets the log filter level for an appender.void
updateAppender(CompositeData appenderConfig)
Update an appender.
-
-
-
Field Detail
-
MBEAN_NAME
static final String MBEAN_NAME
The name of this MBean, equal to the string "Logging".
- See Also:
- Constant Field Values
-
OBJECT_NAME
static final String OBJECT_NAME
The JMX Object Name of this MBean.
- See Also:
- Constant Field Values
-
-
Method Detail
-
setLogLevel
@Deprecated void setLogLevel(String logKey, String level) throws com.opencloud.util.exception.ValidationException, ConfigurationException
Deprecated.usesetLoggerLevel(String, String)
instead.Set the log filter level for a log key.
- Parameters:
logKey
- the log key of the logger, or "root" to update the root logger.level
- the desired log level, ornull
to clear a previously set log level.- Throws:
com.opencloud.util.exception.ValidationException
- if a validation error occurs updating the logger configuration.ConfigurationException
- if a error occurred updating the logger configuration.
-
setLoggerLevel
void setLoggerLevel(String logKey, String level) throws com.opencloud.util.exception.ValidationException, ConfigurationException
Set the log filter level for a log key.
- Parameters:
logKey
- the log key of the logger, or "root" to update the root logger.level
- the desired log level, ornull
to clear a previously set log level.- Throws:
com.opencloud.util.exception.ValidationException
- if a validation error occurs updating the logger configuration.ConfigurationException
- if a error occurred updating the logger configuration.- Since:
- Rhino 2.6.0
-
setAdditivity
@Deprecated void setAdditivity(String logKey, boolean additivity) throws com.opencloud.util.exception.ValidationException, ConfigurationException
Deprecated.usesetLoggerAdditivity(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.
- Parameters:
logKey
- the log key of the logger.additivity
-true
for enabled orfalse
for disabled.- Throws:
com.opencloud.util.exception.ValidationException
- if a validation error occurs updating the logger configuration.ConfigurationException
- if a error occurred updating the logger configuration.
-
setLoggerAdditivity
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.
- Parameters:
logKey
- the log key of the logger.additivity
-true
for enabled,false
for disabled, ornull
to use the platform default.- Throws:
com.opencloud.util.exception.ValidationException
- if a validation error occurs updating the logger configuration.ConfigurationException
- if a error occurred updating the logger configuration.- Since:
- Rhino 2.6.0
-
setLoggerAsynchronous
void setLoggerAsynchronous(String logKey, Boolean asynchronous) throws com.opencloud.util.exception.ValidationException, ConfigurationException
Set the asynchronous mode for a log key.
- Parameters:
logKey
- the log key of the logger, or "root" to update the root logger.asynchronous
-true
for asynchronous,false
for synchronous), ornull
to use the platform default.- Throws:
com.opencloud.util.exception.ValidationException
- if a validation error occurs updating the logger configuration.ConfigurationException
- if a error occurred updating the logger configuration.
-
addComponent
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.
- Parameters:
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 component- Throws:
UnknownAppenderException
com.opencloud.util.exception.ValidationException
- if a validation error occurs adding the component.ConfigurationException
- if a error occurred adding the component.- Since:
- Rhino 2.6.0
- See Also:
buildGenericComponent(String, String[], CompositeData[])
-
addAppenderRef
void addAppenderRef(String logKey, String appenderRef) throws UnknownAppenderException, com.opencloud.util.exception.ValidationException, ConfigurationException
Add a log appender to a log key.
- Parameters:
logKey
- the log key of the logger, or "root" to update the root logger.appenderRef
- the name of the appender.- Throws:
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.
-
removeAppenderRef
void removeAppenderRef(String logKey, String appenderRef) throws UnknownAppenderException, ConfigurationException
Remove a log appender from a log key.
- Parameters:
logKey
- the log key of the logger, or "root" to update the root logger.appenderRef
- the name of the appender.- Throws:
UnknownAppenderException
- if the appender name is not recognised.ConfigurationException
- if a error occurred updating the logger configuration.
-
removeAppender
void removeAppender(String appenderName) throws UnknownAppenderException, ConfigurationException
Delete a log appender.
- Parameters:
appenderName
- the name of the appender to delete.- Throws:
UnknownAppenderException
- if the appender name is not recognised.ConfigurationException
- if a error occurred removing the appender.
-
setThreshold
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.- Parameters:
appenderName
- the name of the appender to reference.threshold
- the log level, ornull
to unset the threshold.- Throws:
com.opencloud.util.exception.ValidationException
- if a validation error occurs updating the appender configuration.ConfigurationException
- if a error occurred updating the appender configuration.
-
createFileAppender
@Deprecated void createFileAppender(String appenderName, String filename) throws ConfigurationException
Deprecated.Creates a rolling log file appender. The maximum file size and backup count will be set to Rhino defaults.
- Parameters:
appenderName
- the name the appender is referenced byfilename
- the target of the appenders log messages- Throws:
ConfigurationException
- if a error occurred creating the appender.
-
createFileAppender
@Deprecated void createFileAppender(String appenderName, String filename, String processName) throws ConfigurationException
Deprecated.Creates a rolling log file appender. The maximum file size and backup count will be set to Rhino defaults.
- Parameters:
appenderName
- the name the appender is referenced byfilename
- the target of the appenders log messagesprocessName
- This argument is ignored- Throws:
ConfigurationException
- if a error occurred creating the appender.
-
createFileAppender
@Deprecated void createFileAppender(String appenderName, String filename, String maxfilesize, Integer maxbackups) throws ConfigurationException
Deprecated.Creates a rolling log file appender.
- Parameters:
appenderName
- the name the appender is referenced byfilename
- the target of the appenders log messagesmaxfilesize
- the maximum size before rollovermaxbackups
- the maximum number of rollovers- Throws:
ConfigurationException
- if a error occurred creating the appender.
-
createFileAppender
@Deprecated void createFileAppender(String appenderName, String filename, String maxfilesize, Integer maxbackups, String processName) throws ConfigurationException
Deprecated.Creates a rolling log file appender.
- Parameters:
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 ignored- Throws:
ConfigurationException
- if a error occurred creating the appender.
-
createSocketAppender
@Deprecated void createSocketAppender(String appenderName, String remoteHost, int port) throws ConfigurationException
Deprecated.Creates a log4j socket appender.
- Parameters:
appenderName
- the name the appender is referenced byremoteHost
- the host to connect toport
- the port to connect to- Throws:
ConfigurationException
- if a error occurred creating the appender.
-
createSocketAppender
@Deprecated void createSocketAppender(String appenderName, String remoteHost, int port, String processName) throws ConfigurationException
Deprecated.Creates a log4j socket appender.
- Parameters:
appenderName
- the name the appender is referenced byremoteHost
- the host to connect toport
- the port to connect toprocessName
- This argument is ignored- Throws:
ConfigurationException
- if a error occurred creating the appender.
-
createSyslogAppender
@Deprecated void createSyslogAppender(String appenderName, String syslogHost, String facility) throws ConfigurationException
Deprecated.Create a syslog appender.
- Parameters:
appenderName
- the name the appender is referenced bysyslogHost
- the syslog hostfacility
- the syslog facility log message target- Throws:
ConfigurationException
- if a error occurred creating the appender.
-
createSyslogAppender
@Deprecated void createSyslogAppender(String appenderName, String syslogHost, String facility, String processName) throws ConfigurationException
Deprecated.Create a syslog appender.
- Parameters:
appenderName
- the name the appender is referenced bysyslogHost
- the syslog hostfacility
- the syslog facility log message targetprocessName
- This argument is ignored- Throws:
ConfigurationException
- if a error occurred creating the appender.
-
createLogNotificationAppender
@Deprecated void createLogNotificationAppender(String appenderName, String threshold) throws ConfigurationException
Deprecated.Create a LogNotification appender.
- Parameters:
appenderName
- the name the appender is referenced by- Throws:
ConfigurationException
- if a error occurred creating the appender.
-
rollover
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.
- Parameters:
appenderName
- the name of the appender.- Throws:
NullPointerException
- ifappenderName
isnull
.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.
-
rolloverAllLogFiles
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.
- Throws:
ConfigurationException
- if a error occurred rolling the appenders.
-
getLoggerConfig
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.
- Parameters:
logKey
- the log key of the logger.- Returns:
- a
CompositeData
as given in the method description. - Throws:
NullPointerException
- iflogKey
isnull
.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.- Since:
- Rhino 2.6.0
-
getEffectiveLoggerConfig
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.
- Parameters:
logKey
- the log key of the logger.- Returns:
- a
CompositeData
as given in the method description. - Throws:
NullPointerException
- iflogKey
isnull
.ManagementException
- if the logger configuration could not be returned due to an internal error.
-
setLoggerConfig
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.
- Parameters:
logKey
- the log key of the logger.level
- the log level to assign to the logger. May benull
if no level should be assigned.additivity
- the additivity of the logger. May benull
if the default additivity should be used for the logger.asynchronous
- the asynchronosity of the logger. May benull
if the default asynchronosity should be used for the logger.appenderRefs
- the names of the appenders that should be attached to the logger. May benull
.components
- descriptions of plugin components that should be associated with the logger. AppropriateCompositeData
objects can be created usingbuildGenericComponent(java.lang.String, java.lang.String[], javax.management.openmbean.CompositeData[])
. May benull
.- Returns:
true
if the logger configuration was successfully created, orfalse
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".- Throws:
NullPointerException
- iflogKey
isnull
.com.opencloud.util.exception.ValidationException
- if the logger configuration fails a basic validation check.ConfigurationException
- if an error occurs configuring the logger.- Since:
- Rhino 2.6.0
- See Also:
buildGenericComponent(String, String[], CompositeData[])
-
removeLoggerConfig
void removeLoggerConfig(String logKey) throws NullPointerException, LoggerNotConfiguredException, ConfigurationException
Remove a log key configuration.
- Parameters:
logKey
- the log key of the logger.- Throws:
NullPointerException
- iflogKey
isnull
.LoggerNotConfiguredException
- if a logger for the specified log key is not configured.ConfigurationException
- if an error occurs removing the logger configuration.- Since:
- Rhino 2.6.0
-
getAdditivity
@Deprecated boolean getAdditivity(String logKey)
Deprecated.usegetLoggerAdditivity(String)
} instead.Get the additivity of a log key.
- Parameters:
logKey
- the log key of the logger- Returns:
true
if enabled orfalse
if disabled. If the logger is not configured then the default platform additivity (true
is returned.
-
getLoggerAdditivity
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
.- Parameters:
logKey
- the log key of the logger, or "root" to query the root logger- Returns:
- the configured additivity for the logger where
true
means enabled andfalse
means disabled. - Throws:
NullPointerException
- iflogKey
isnull
.LoggerNotConfiguredException
- if a logger for the specified log key is not configured.ConfigurationException
- if a error occurred reading the logger configuration.- Since:
- Rhino 2.6.0
-
getLoggerAsynchronous
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.- Parameters:
logKey
- the log key of the logger, or "root" to query the root logger- Returns:
- the configured asynchronosity for the logger where
true
means asynchronous andfalse
means synchronous. - Throws:
NullPointerException
- iflogKey
isnull
.LoggerNotConfiguredException
- if a logger for the specified log key is not configured.ConfigurationException
- if a error occurred reading the logger configuration.
-
getEffectiveLogLevel
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.
- Parameters:
logKey
- the log key of the logger, or "root" to query the root logger- Returns:
- the filter level used for the logger.
-
getLogLevel
@Deprecated String getLogLevel(String logKey)
Deprecated.usegetLoggerLevel(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
.- Parameters:
logKey
- the log key of the logger.- Returns:
- the log cut off filter level
-
getLoggerLevel
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
.- Parameters:
logKey
- the log key of the logger, or "root" to query the root logger- Returns:
- the log cut off filter level
- Throws:
NullPointerException
- iflogKey
isnull
.LoggerNotConfiguredException
- if a logger for the specified log key is not configured.ConfigurationException
- if a error occurred reading the logger configuration.- Since:
- Rhino 2.6.0
-
getLogKeys
String[] getLogKeys()
Get a list of all known log keys. This does include the implicit log key "root".
- Returns:
- the log keys.
-
getConfiguredLogKeys
String[] getConfiguredLogKeys() throws ConfigurationException
Get a list of all log keys that have some configuration associated with them.
- Returns:
- the log keys.
- Throws:
ConfigurationException
- if a error occurred reading the logger configuration.
-
getLoggersReferencingAppender
String[] getLoggersReferencingAppender(String appender) throws UnknownAppenderException, ConfigurationException
Get the names of all loggers that reference an appender.
- Parameters:
appender
- the name of the appender.- Returns:
- the names of the loggers referencing the appender.
- Throws:
UnknownAppenderException
- if the appender is not configured.ConfigurationException
- if an error occurred reading the logging configuration.
-
getAppenderRefs
@Deprecated String[] getAppenderRefs(String logKey) throws ConfigurationException
Deprecated.usegetLoggerAppenderRefs(String)
instead.Get the names of the appenders attached to a log key.
- Parameters:
logKey
- the log key of the logger, or "root" to query the root logger- Returns:
- the appenders names
- Throws:
ConfigurationException
- if a error occurred reading the logger configuration.
-
getLoggerAppenderRefs
String[] getLoggerAppenderRefs(String logKey) throws NullPointerException, LoggerNotConfiguredException, ConfigurationException
Get the names of the appenders attached to a logger.
- Parameters:
logKey
- the log key of the logger, or "root" to query the root logger- Returns:
- the appenders names.
- Throws:
NullPointerException
- iflogKey
isnull
.LoggerNotConfiguredException
- if a logger for the specified log key is not configured.ConfigurationException
- if a error occurred reading the logger configuration.- Since:
- Rhino 2.6.0
-
isExists
@Deprecated boolean isExists(String logKey)
Deprecated.useisLoggerExists(String)
instead.Determine if a logger for the given log key currently exists.
- Parameters:
logKey
- the log key of the logger- Returns:
true
if a logger exists,false
otherwise.
-
isLoggerExists
boolean isLoggerExists(String logKey)
Determine if a logger for the given log key currently exists.
- Parameters:
logKey
- the log key of the logger- Returns:
true
if a logger exists,false
otherwise.- Since:
- Rhino 2.6.0
-
isLoggerConfigured
boolean isLoggerConfigured(String logKey) throws NullPointerException, ConfigurationException
Determine if the log key has any configuration associated with it.
- Parameters:
logKey
- the log key of the logger- Returns:
true
if configuration exists,false
otherwise.- Throws:
NullPointerException
- iflogKey
isnull
.ConfigurationException
- if an error occurs reading the logger configuration.- See Also:
setLoggerConfig(String, String, Boolean, Boolean, String[], CompositeData[])
-
getAppenders
String[] getAppenders() throws ConfigurationException
Get a list of all configured appenders.
- Returns:
- the names of the appenders.
- Throws:
ConfigurationException
- if a error occurred reading the appender configuration.
-
getAppenderType
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)
.- Parameters:
appenderName
- the name of the appender.- Throws:
UnknownAppenderException
- if the appender name is not recognised.ConfigurationException
- if a error occurred reading the appender configuration.
-
getAppenderInfo
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.
- Parameters:
appenderName
- the name of the appender.- Throws:
UnknownAppenderException
- if the appender name is not recognised.ConfigurationException
- if a error occurred reading the appender configuration.- Since:
- Rhino 2.6.0
-
getFileAppenderInfo
@Deprecated CompositeData getFileAppenderInfo(String appenderName) throws UnknownAppenderException, com.opencloud.util.exception.ValidationException, ConfigurationException
Deprecated.usegetAppenderInfo(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"
- Parameters:
appenderName
- the name of the appender.- Throws:
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.
-
-
getSocketAppenderInfo
@Deprecated CompositeData getSocketAppenderInfo(String appenderName) throws UnknownAppenderException, com.opencloud.util.exception.ValidationException, ConfigurationException
Deprecated.usegetAppenderInfo(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"
- Parameters:
appenderName
- the name of the appender.- Throws:
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.
-
-
getSyslogAppenderInfo
@Deprecated CompositeData getSyslogAppenderInfo(String appenderName) throws UnknownAppenderException, com.opencloud.util.exception.ValidationException, ConfigurationException
Deprecated.usegetAppenderInfo(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"
- Parameters:
appenderName
- the name of the appender.- Throws:
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.
-
-
getAppenderProperties
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"
- Parameters:
appenderName
- the name of the appender to reference- Throws:
UnknownAppenderException
- if the appender name is not recognised.ConfigurationException
- if a error occurred reading the appender configuration.
-
-
getThreshold
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.
- Parameters:
appenderName
- the name of the appender.- Returns:
- the log filter level, or
null
if a threshold is not configured for the appender. - Throws:
UnknownAppenderException
- if the appender name is not recognised.ConfigurationException
- if a error occurred reading the appender configuration.
-
setAlarmLogPeriod
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.
- Parameters:
period
- the interval between active alarm logging, measured in seconds.- Throws:
IllegalArgumentException
- if the specified period is less than 0 seconds.ConfigurationException
- if an error occurs updating the logging configuration.
-
getAlarmLogPeriod
int getAlarmLogPeriod() throws ConfigurationException
Get the interval between periodic active alarm logs.
- Returns:
- the period interval, measured in seconds.
- Throws:
ConfigurationException
- if an error occurs reading the logging configuration.
-
createAppender
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:
- Parameters:
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.- Throws:
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.- Since:
- Rhino 2.6.0
- See Also:
buildGenericComponent(String, String[], CompositeData[])
-
createAppender
void createAppender(CompositeData appenderConfig) throws com.opencloud.util.exception.ValidationException, ConfigurationException
Create an appender.
- Parameters:
appenderConfig
- the full appender configuration.- Throws:
com.opencloud.util.exception.ValidationException
- if a validation error occurs creating the appender.ConfigurationException
- if an error occurs creating the appender.- Since:
- Rhino 2.6.0
- See Also:
buildGenericComponent(String, String[], CompositeData[])
-
updateAppender
void updateAppender(CompositeData appenderConfig) throws com.opencloud.util.exception.ValidationException, ConfigurationException
Update an appender.
- Parameters:
appenderConfig
- the full appender configuration.- Throws:
com.opencloud.util.exception.ValidationException
- if a validation error occurs updating the appender.ConfigurationException
- if an error occurs updating the appender.- Since:
- Rhino 2.6.0
- See Also:
buildGenericComponent(String, String[], CompositeData[])
-
buildGenericComponent
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);
- Parameters:
pluginName
- the name of the plugin.properties
- the properties specified "name=value" strings in an Array.components
- additional components required by this component.- Returns:
- a composite data object that describes the plugin component configuration.
- Throws:
ConfigurationException
- if an error occurs creating the component.- Since:
- Rhino 2.6.0
-
getLoggingPropertyNames
String[] getLoggingPropertyNames() throws ConfigurationException
Get the set of all known logging properties
- Returns:
- an array of all known properties.
- Throws:
ConfigurationException
- if an error occurs reading the logging configuration.- Since:
- Rhino 2.6.0
-
getLoggingProperty
String getLoggingProperty(String name) throws UnrecognizedLoggingPropertyException, ConfigurationException
Get the value of a logging property.
- Parameters:
name
- the logging property name.- Returns:
- the property’s value.
- Throws:
UnrecognizedLoggingPropertyException
- if the named logging property does not exist.ConfigurationException
- if an error occurs reading the logging configuration.- Since:
- Rhino 2.6.0
-
getLoggingProperties
Map<String,String> getLoggingProperties() throws ConfigurationException
Get the set of all logging properties.
- Returns:
- a map of logging property name→value pairs. Both map keys and values are Strings.
- Throws:
ConfigurationException
- if an error occurs reading the logging configuration.- Since:
- Rhino 2.6.0
-
setLoggingProperty
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.
- Parameters:
name
- the property name.value
- the property’s value.- Throws:
ConfigurationException
- if an error occurs updating the logging configuration.- Since:
- Rhino 2.6.0
-
setLoggingProperties
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.
- Parameters:
properties
- a map of property name to property value.- Throws:
ConfigurationException
- if an error occurs updating the logging configuration.- Since:
- Rhino 2.6.0
-
removeLoggingProperty
void removeLoggingProperty(String name) throws UnrecognizedLoggingPropertyException, ConfigurationException
Remove a logging property.
- Parameters:
name
- name of the property to remove.- Throws:
UnrecognizedLoggingPropertyException
- if the named logging property does not exist.ConfigurationException
- if the property is in use and cannot be removed.- Since:
- Rhino 2.6.0
-
-