Hi, I'm currently looking over cocoon-spring-configurator sources for a hints how to implement reconfiguration via JMX and there are my reflections:
In current solution there is Log4JConfigurator class that handles configuration of log4j and by calling: setResource(resource); afterPropertiesSet(); we could change logging properties. (May it cause any errors or exceptions when it would be performed on a fully started system ?) IMHO current solution is useless if it would be accessed directly by JMX because as an argument must be passed path to local file with new setting. Therefor there should be one more layer that would be giving possibility of review all current settings and possibility of change one (or more) of them. So I'm thinking of new class eg. JmxLog4JConfigurator that would warps around Log4JConfigurator. In this new class we would have tree representation of xml configuration file that gives us simple way of reconfiguration. After all changes there should be called save() or commit() method that would collect all settings and pass them via setResource to Log4JConfigurator and call afterPropertiesSet() to perform changes. But there is a small problem, because currently there isn't any way of obtaining actual configuration, so there must be added one getter method into Log4JConfigurator that would return all actual settings. It is my idea of solving "review and reconfigure log4j settings via JMX" ... is it correct ? ;) Best, -- Blog: http://luksza.org LinkedIn: http://www.linkedin.com/in/dariuszluksza
