I am using IBM WAS as my server for my application.I have given log4j.properties in classpath of IBM WAS.It works fine.I want to change the name of log4j.properties to something like abclog4j.properties.My application is Eclipse based. If I change it and start my server it gives me log4j : WARN Please initialize the log4j system properly error How can I change it's name?
Asked
Active
Viewed 639 times
1 Answers
1
According to this page: http://logging.apache.org/log4j/1.2/manual.html
The preferred way to specify the default initialization file is through the log4j.configuration system property. In case the system property log4j.configuration is not defined, then set the string variable resource to its default value "log4j.properties".
So if you set the log4j.configuration system property before log4j is dynamically loaded (i.e., referenced in any object), then log4j will use that value for the name of the config file.
System.setProperty("log4j.configuration","abclog4j.properties");
You could do this in a static block at the beginning of some base class so that it is set before any log4j references are encountered.

Todd Phillips
- 121
- 8