org.apache.cocoon.monitoring.reconfiguration
Class Log4JReconfigurator

java.lang.Object
  extended by org.apache.cocoon.monitoring.reconfiguration.Log4JReconfigurator

@ManagedResource(objectName="org.apache.cocoon:group=Reconfiguration,name=Log4JReconfigurator")
public class Log4JReconfigurator
extends Object

This is a JMX MBean class that expose methods for log4j configuration.


Constructor Summary
Log4JReconfigurator()
           
 
Method Summary
 String[] getLoggers()
          Find all configured loggers and returns is as a array of Strings
 boolean loadNewConfigurationFile(String path)
          Allows to change configuration of log4j on the fly.
 boolean setLoggingLevel(String category, String newLogLevel)
          Sets logging level for a particular package or a class.
 boolean setLoggingTempoporalLevel(String category, String temporalLogLevel, String timeOut)
          Sets new logging level for amount of time.
 void setSettings(org.apache.cocoon.configuration.Settings s)
          Inject the settings object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Log4JReconfigurator

public Log4JReconfigurator()
Method Detail

getLoggers

@ManagedAttribute(description="Return a list of all configured loggers with their level.")
public final String[] getLoggers()
Find all configured loggers and returns is as a array of Strings

Returns:
list of all configured loggers with their level.

setLoggingLevel

@ManagedOperation(description="Sets logging level for a particular package or a class. Returns true if operation was successful.")
@ManagedOperationParameters(value={,})
public final boolean setLoggingLevel(String category,
                                                                                                 String newLogLevel)
Sets logging level for a particular package or a class.

Parameters:
category - name of the log category (usually a package or class name) whose log level should be changed.
newLogLevel - new log level for that category. Available log levels are: OFF, INFO, WARN, ERROR, FATAL, TRACE, DEBUG, ALL
Returns:
true if operation was successful, false otherwise.

setLoggingTempoporalLevel

@ManagedOperation(description="Sets new logging level for amount of time. After timeout log level is set back to old value.")
@ManagedOperationParameters(value={,,})
public final boolean setLoggingTempoporalLevel(String category,
                                                                                                           String temporalLogLevel,
                                                                                                           String timeOut)
Sets new logging level for amount of time. After timeout log level is set back to old value.

Parameters:
category - name of the log category (usually a package or class name) whose log level should be changed.
temporalLogLevel - temporal log level for that category that should be set for specified amount of time.
timeOut - amount of time that temporalLevel should be active. Value of timeOut should match regular expression: ^[0-9.]+[dhm]?$ where d means day, h hours and m minutes
Returns:
true if operation was successful, false otherwise.

loadNewConfigurationFile

@ManagedOperation(description="Allows to change configuration of log4j on the fly. This function support both XML and properties configuration files. Before reloading configuration it checks that the new config file contains at least one appender and all output files are accessible (for XML configs italso validate XML syntax using schema or DTD)")
@ManagedOperationParameters(value=)
public final boolean loadNewConfigurationFile(String path)
                                       throws Exception
Allows to change configuration of log4j on the fly. This function support both XML and properties configuration files. Before reloading the configuration it checks that the new config file contains at least one appender and all output files are accessible (for XML configs it also validate XML syntax using schema or DTD)

Parameters:
path - absolute path to configuration file located on the server.
Returns:
true if operation was successful, false otherwise.
Throws:
Exception - if something unusual happens

setSettings

public final void setSettings(org.apache.cocoon.configuration.Settings s)
Inject the settings object.

Parameters:
s - The settings bean.


Copyright © 2008-2011 The Apache Software Foundation. All Rights Reserved.