Tuesday, May 20, 2008

log4j in weblogic 9.2

WebLogic 9.2 and the application's need for log4j-1.2.8.jar file to implement the logger option.The following procedures are give the step by step guidelines to implement the Log4J logger in weblogic 9.2 portal server.

1. Go to folder.
2. Copy the log4j Configuration in to domain folder.
3. In the startWebLogic.cmd that is run when starting the WebLogic Server, the following lines are in the file:

set JAVA_OPTIONS=%JAVA_OPTIONS% -Dlog4j.ignoreTCL=true
-Dlog4j.configuratorClass=com.foo.core.log.ReloadingDOMConfigurator
-Dlog4j.configuration=file://%DOMAIN_HOME%/log4jConfig.xml
set SAVE_JAVA_OPTIONS=

set CLASSPATH=%SAVE_CLASSPATH%;%DOMAIN_HOME%\lib\mylog4j.jar

The mylog4j.jar and the log4j-1.2.8.jar are located in the \lib. WebLogic puts log4j.jar in the classpath before my jars when the server starts.

Open the setDomainEnv.cmd script,located in the BIN directory of your created domain directory. Find the following line in the setDomainEnv.cmd script:
if NOT "%LOG4J_CONFIG_FILE%"=="" (
Add the following two lines immediately before the line specified in the preceding step:
set LOG4J_CONFIG_FILE=%DOMAIN_HOME%\log4jConfig.xmlfor %%i in ("%LOG4J_CONFIG_FILE%") do set LOG4J_CONFIG_FILE=%%~fsiSave the file and exit your text editor. Finally run the setDomainEnv.cmd and startWebLogic.cmd ,the logger will work effectivly....

No comments: