org.apache.cocoon.monitoring.reconfiguration
Class LogbackReconfigurator

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

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

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


Constructor Summary
LogbackReconfigurator()
           
 
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 logback 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 settings)
          Inject the settings object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogbackReconfigurator

public LogbackReconfigurator()
Method Detail

setSettings

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

Parameters:
s - The settings bean.

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, ERROR, WARN, INFO, DEBUG, TRACE, 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 logback on the fly. Before reloading the configuration it checks that the new config file contains at least one appender, that all output files are accessible and that the file is valid as XML.")
@ManagedOperationParameters(value=)
public final boolean loadNewConfigurationFile(String path)
                                       throws IOException,
                                              ConfigurationException,
                                              ch.qos.logback.core.joran.spi.JoranException
Allows to change configuration of logback on the fly. Before reloading the configuration it checks that the new config file contains at least one appender, that all output files are accessible and that the file is valid as XML.

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
IOException
ConfigurationException
ch.qos.logback.core.joran.spi.JoranException


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