Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using log4j logging in weblogic 9/10

In weblogic I can configure in the console for the Serverlog to use log4j instead of default JDK logging.

However the serverlog is not using a log4j.properties file, but seems to use the configuration in config.xml Even if the log4j.properties file is in the classpath and I set these properties:

set JAVA_OPTIONS=%JAVA_OPTIONS% -Dlog4j.configuration=file:<path>/log4j.properties
set JAVA_OPTIONS=%JAVA_OPTIONS% -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger   
set JAVA_OPTIONS=%JAVA_OPTIONS% -Dweblogic.log.Log4jLoggingEnabled=true 

Is it possible to use log4j.properties configuration for Weblogic Server Logging, or can I only change the log4j configuration with java code?

like image 803
Edwin Avatar asked Feb 23 '09 08:02

Edwin


1 Answers

I don't know anything about WebLogic in particular, but adding -Dlog4j.debug will cause log4j to tell you where it's looking for its configuration. I've found that to be invaluable when tracking down logging issues in tomcat previously.

Check out the docs for PropertyConfigurator and DOMConfigurator for details on the log4j configuration process.

like image 75
Dominic Mitchell Avatar answered Oct 03 '22 05:10

Dominic Mitchell