cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dariusz Łuksza <>
Subject Re: [c3] Reconfigure log4j settings via JMX.
Date Thu, 02 Apr 2009 19:32:16 GMT
On Thu, Apr 2, 2009 at 12:04 PM, Reinhard Pötz <> wrote:
> Thanks for your analysis. I'm quite confident that we only have to
> change the Log4JConfigurator a little to get what we want. But let's try
> to be more specific about that. I think that we have to distinguish
> between two use cases:
>  1. Changing the log level of one particular log target (usually the
>    class name)
>  2. Reloading the complete configuration file
> The first one is useful when you want to trace unexpected behavior of a
> production system. This is just temporary and doesn't need to be
> persisted. We could even think about letting those changes expire after
> some time provided by the user or use a default value (e.g. one hour).

Idea of "temporary changed log level" is very nice, I like it ;)

> If you want to change your logging file permanently or more
> substantially (e.g. you want to add an appender), you have to edit the
> logging file. I'm not sure how this should be done in detail, but I was
> thinking about changing the configuration file (of course in this case
> the file mustn't be part of the WAR file but has to be put separately
> into the filesystem) and then you push a 'reload button' in the JMX
> console. But maybe there is some more elegant way to do this.

IMHO this feature would be great for project kick of but I have idea
how to extend it in next versions.

> It would be nice to validate the file before it gets applied so that
> log4j doesn't get into an indefinite state

Yes, validation is necessary.

> By the way, see that I
> haven't tried but from looking into the code it goes into the right
> direction.

It is very simple solution but I think I found there way how to get
logger settings without changing Log4JConfigurator ...  actually we
can do every thing without Log4JConfigurator, but I'm, not sure if it
is our way to do it. Going back to the heart of the matter using
LogManager class from log4j I think we can obtain actual configuration
of log4j, add logging configuration for single class/package and
change these configurations.


I think that this task wouldn't be so hard as I think so ;)

Best regards

View raw message