This content has been marked as final.
Show 3 replies
-
1. Re: Programmatic Log4j Configuration
barthjj Dec 11, 2007 12:44 PM (in response to barthjj)Looks like nobody cares about this. I'll respond with my results so far anyway.
I've setup a component as:@Name("configLogger") @Scope(value = ScopeType.APPLICATION) @Startup public class ConfigLog4j { @Create public void configureLogger() { URL url = new URL("file:///log4j.xml"); PropertyConfigurator.configure(url); } }
I've setup the log4j.xml that is packaged with the war to be priority value="INFO". I made the external log4j.xml set priority value="DEBUG". I'm expecting that after the above code is run, all of the logs should switch to DEBUG, but nothing is changing.
Any help? -
-
3. Re: Programmatic Log4j Configuration
barthjj Dec 12, 2007 12:02 PM (in response to barthjj)Thanks for the link. I looked at the code there and found out what my problem was. I was using PropertyConfigurator instead of DOMConfigurator. Here's the working code
@Name("configLogger") @Startup @Scope(APPLICATION) public class ConfigLog4j{ @Create public void init() { DOMConfigurator.configure("c:/log4j.xml"); } }