The main problem is that log4j is initialized by commons-logging.
The best way I can think of for configuring log4j is in the org.apache.servicemix.Main class, but i'd like to keep it log4j independant (maybe using reflection to call another class, so that if log4j is not in the classpath, it would still work). The reason is that once you start spring, it configures commons-logging, which in turn configure log4j. Not quite sure if you can do that from the spring config files (which would be nice), and ask log4j to reconfigure itself. I guess it should work. In this case, there would be not ties to servicemix at all, just a spring factory to reconfigure log4j with all the needed settings (it would be a bit more difficult to put it in jmx though). On 10/20/06, Thomas TERMIN <[EMAIL PROTECTED]> wrote:
Yes I know. But it might be better not to use the configureAndWatch method but instead use an own mechanism which I can change via JMX. I have to have a look at it first. You could give me a hint where servicmix does initialise the log4j system at the moment but I can also have a look at it. What do you think? Would you use the configureAndWatch mechanism? I would like to change the delay time at runtime and use a TimerTask to schedule this stuff. Then you could also stop scheduling via JMX and so on. Guillaume Nodet wrote: > See http://logging.apache.org/log4j/docs/faq.html#3.6 > I don't think there is much code to write... > > On 10/20/06, Thomas TERMIN <[EMAIL PROTECTED]> wrote: >> Sorry I did not mean a servicemix component. I use allways the word >> component ;-) since I started working with servicemix. What you said is >> exactly what I meant. So I will have a look on it! >> >> Thanks, >> Thomas >> >> Guillaume Nodet wrote: >> > I would rather use a ServiceMix service instead of >> > a component, as this is more related to management / >> > configuration than a component if I understand you >> > correctly. ... and use a timer to reload the log4j config. >> > But iirc, log4j already has this feature, we just need to >> > enable it. >> > >> > On 10/20/06, Thomas TERMIN <[EMAIL PROTECTED]> wrote: >> >> Hello Guillaume, >> >> >> >> We would need a log4j Component where you can change the debug >> level at >> >> runtime. I would implement a MBean which initialise the log4j >> system at >> >> startup and also have a scheduler which looks if the log4j.xml has >> >> changed and then reinitialise the log4j system. >> >> >> >> If I would provide you a patch would you accept this in servicemix? >> >> >> >> Cheers, >> >> Thomas Termin >> >> >> > >> > >> >> > >
-- Cheers, Guillaume Nodet
