Hey folks. I'm pretty deep into trying to get log4j to reconfig without a restart. I'm using a servlet to cause this code snippet to run:
DOMConfigurator conf = new DOMConfigurator(); conf.doConfigure(doc.getDocumentElement(), hierarchy);
the document that I've read in is the correct one, and doConfigure seems to be doing its work.
However, the change does not take.
The code path appears to be the same as the one followed when using the configureAndWatch() method on the configurator which sets up a watchdog on the xml file. All the watchdog does is rerun doConfigure on the file.
configureAndWatch however does not work in my case as we've had to hack the normal loader to allow a different log4j config per webapp as defined in each ones log4j.xml file.
Any idea why the reconfig isn't taking?
Thanks all for the help. Its a real stumper at this point and I've probably been looking at it too long.
What I'm trying to do is change from error level to debug level without having to restart the server. I have more than one webapp running on the appserver and need to have different logging configs for each one, and as far as I could find, subclassing the RepositorySelector in this manner is the only way to manage it.
As I said, when I reconfig by hitting the servlet and reading the changed log4j xml, the new information makes it to and is used by the Configurator. However, the log levels aren't changed in the webapp.
If you can modify the log4j code I figure you should be able to find suitable log4j resources, ... sorry, but one of my pet peeves is posts like "could it be true? no one here has any idea?" At least you didn't use the banging head graemlin.
The JBoss or Other Open Source Projects (description: "Jakarta Projects (like Log4j etc.)...") forums here at javaranch seem like better forums for your questions, since you seem to have some JBoss specific log4j issues and are trying to solve them by extending log4j.
Its not a log4j issue... Its a jboss one. Wherever the log4j config is stored in the jboss structure, its not getting replaced.
And yes, of course I'm polling other resources My comment was more related to the fact that this is the first time the Ranch hadn't posted some sort of response within 1 day to a well-formed question from me. Sorry to have offended your sensibilities.
Hey, can a friendly bartender or sheriff move this over to the JBoss forum since Sean says its a JBoss issue?
Yes, I can, and will...
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop