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 Details

    • Log4jConfigurator

      public Log4jConfigurator()
  • Method Details

    • getLoggers

      @ManagedAttribute(description="The available loggers") public List<String> getLoggers()
      Description copied from interface: LogConfiguratorMXBean
      Gives a list with the names of the loggers defined.
      Specified by:
      getLoggers in interface LogConfiguratorMXBean
      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 interface LogConfiguratorMXBean
      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 be DEBUG.

      Specified by:
      setLogLevel in interface LogConfiguratorMXBean
      Parameters:
      loggerName - the name of the logger
      level - the new log level