Class Log4jConfigurator
java.lang.Object
com.reallifedeveloper.common.infrastructure.jmx.Log4jConfigurator
- All Implemented Interfaces:
LogConfiguratorMXBean
@ManagedResource(description="Log4j Configuration")
public class Log4jConfigurator
extends Object
implements LogConfiguratorMXBean
An implementation of the JMX
LogConfiguratorMXBean
interface using Log4j.- Author:
- RealLifeDeveloper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGives a list with the names of the loggers defined.getLogLevel
(String loggerName) Gives the log level of the named logger.void
setLogLevel
(String loggerName, String level) Sets the log level of the named logger.
-
Constructor Details
-
Log4jConfigurator
public Log4jConfigurator()
-
-
Method Details
-
getLoggers
Description copied from interface:LogConfiguratorMXBean
Gives a list with the names of the loggers defined.- Specified by:
getLoggers
in interfaceLogConfiguratorMXBean
- Returns:
- a list with the logger names
-
getLogLevel
@ManagedOperation(description="Gives the log level for a logger") @ManagedOperationParameters(@ManagedOperationParameter(name="logger",description="The name of the logger")) public String getLogLevel(String loggerName) Description copied from interface:LogConfiguratorMXBean
Gives the log level of the named logger.- Specified by:
getLogLevel
in interfaceLogConfiguratorMXBean
- Parameters:
loggerName
- the name of the logger- Returns:
- the log level of
logger
-
setLogLevel
@ManagedOperation(description="Sets the log level for a logger") @ManagedOperationParameter(name="logger",description="The name of the logger") @ManagedOperationParameter(name="level",description="The new log level") public void setLogLevel(String loggerName, String level) Sets the log level of the named logger.If
level
cannot be parsed as a log level, the level is assumed to beDEBUG
.- Specified by:
setLogLevel
in interfaceLogConfiguratorMXBean
- Parameters:
loggerName
- the name of the loggerlevel
- the new log level
-