We solved this problem by checking if Log4J is already configured before we configure it. In Jboss Log4J is already configured on startup. In Weblogic it's not...
// We check the system property:
String log4jConfig = System.getProperty("log4j.configuration");
// And our own properties file
String log4jFile = getInitParameter("log4j-init-file");
if (log4jConfig != null && log4jConfig.length() > 0) {
//Use Systems configuration( .... -Dlogj4.configuration=/path/to/log4j.*)
System.out.println("Log4J ConfigFile: " + log4jConfig);
configureLog4j(log4jConfig);
}
else if (log4jFile != null && log4jFile.length() > 0) {
//logj4.* from web.xml
System.out.println("Log4j file (from web.xml): " + configDirectory + log4jFile);
configureLog4j(configDirectory + log4jFile);
}
else {
//no log4j.configuration found
System.out.println("Using BaseConfigurator. Please specify the log4j.configuration in the System Properties");
BasicConfigurator.configure();
}
I think this will help...
Greatz,
Marco