cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dariusz Łuksza <dariusz.luk...@gmail.com>
Subject Fwd: [c3-monitoring] Logging reconfiguration.
Date Thu, 30 Apr 2009 22:47:58 GMT
2009/4/25 Dariusz Łuksza <dariusz.luksza@gmail.com>:
> I'm not quite sure what should I do witch "old"
> cocoon-configuration-api and cocoon-spring-configurator. Should I :
>  [1] add dependency to cocoon-monitoring on cocoon-configuration-api
> or cocoon-spring-configurator,
>  [2] create another solution based on cocoon-spring-configurator
>  [3] integrate both project and add it to c3
> ?

For now I've decided that I'll user directly LogRepository log4j to achieve
reconfiguration of logging level for single class or package.

First milestone in logging reconfiguration via JMX would be adding
possibility of (permanent or temporal) change log level for single package
or class.

To achieve that I implemented two class (Log4JReconfigure and
RestoreLoggingConfiguration) and added cocoon-monitoring.xml for spring-jmx
configuration.

So first class (Log4JReconfigure) is an MBean that would be exposed on JXM
service. It has 3 public methods :
* getLoggers - returns all configured loggers with their logging level
* setLoggingLevel - this method set logging level for permanent (if logger
already exist it will only change logging level in other case it will create
logger with that level)
* setLoggingTempoporalLevel - change logging level or single class or
package only some time and then log level is set back to old value
Second class (RestoreLoggingConfiguration) is used only
in setLoggingTempoporalLevel method and it performs restore old config after
specified time (it use Timer class inside ;))
Full sources of this classes are in attachment, for proper work you will
need new-cocoon-monitoring-module2.patch from  COCOON3-33 jira issue.
btw. Is there any possibility to write junit test for that functionalities ?

In future this code could be moved to cocoon-spring-configurator project.

It is only my proposition how this fictionally could be implemented.

WDYT ?

-- 
Best regards

Blog: http://luksza.org
LinkedIn: http://www.linkedin.com/in/dariuszluksza

Mime
View raw message