This discussion is archived
2 Replies Latest reply: Apr 21, 2010 11:59 PM by 164415 RSS

log4j Configuration in Standalone Weblogic Server - ADF

448875 Newbie
Currently Being Moderated

Thought this might be useful.

Steps to configure Log4j in Standalone weblogic Server are as depicted:

1. Login to the Standalone Server (which is configured for ADF deployments),
and select Servers under Environment
2. Select AdminServer --> Logging Tab. Here you can change the log file name, which contains the logging
information of the entire app server and not the ones which you have added i.e. at the application level.
3. Select Advanced section under Logging tab and change the Logging implementation to log4j from JDK
JDK is the default logging implementation.
4. You can also check the checkbox Redirect stdout logging enabled, which will redirect all the output of the server to all the log
5. Next is configuring the domain,
Select your domain from multiple/single domain as your weblogic server is configured.
In my case I have 2 domains, 1 is ADF_SERVER (which I configured for log4j)
and the other is base_domains, which is the default domain set up during configuration.

6. Now, in order to configure log4j in Weblogic, we need 3 files, or log4j.xml, log4j-1.2.15.jar, wllog4j.jar
This configuration is done using file. file contains all the configuration information for log4j, like what levels of debug messages
should be displayed in the console and in file. It also contains file name, that should be created when the application
is accessed and which contains only the application specific log messages.
The other 2 jar files have the libraries for log4j.
7. Copy the to the domain root folder, which is in my case, ADF_SERVER is the domain
so the root folder is
8. Copy the jar files log4j-1.2.15.jar and wllog4j.jar for the lib folder under the domain root

9. After adding the files to the respective folders, we need to configure the startup script of the weblogic
server, which will make these files avaible to the weblogic server classpath during startup.
Access the startWebLogic.cmd file under
D:\Installs\Oracle\WebLogicServerHome\user_projects\domains\ADF_SERVER\bin\ - folder
-- File name - startWebLogic.cmd
Open the startWebLogic.cmd in notepad and add the following commands (may be below set local)

set LOG4J_CONFIG_FILE=D:\Installs\Oracle\WebLogicServerHome\user_projects\domains\ADF_SERVER\

set SAVE_CLASSPATH=%CLASSPATH%;D:\Installs\Oracle\WebLogicServerHome\user_projects\domains\ADF_SERVER\config

By the above steps, I have configured the file and set the classpath accordingly.
10. Make sure your application has logger messages to get displayed in the log file.
11. After doing the above configuration, restart the server.

12. Below is an example file, which is configured at the DEBUG level.
Also, as the file appender R defines, it will create example.log file, which will contain
only the user specific log messages in the application.
This example.log file will be created under ADF_SERVER folder


---- used for this---

# WLS Admin console log4j configuration file

# Create one appender, one called stdout
# and set default level to DEBUG
# log4j.rootLogger=WARN, stdout -- Commented, to add file appender
#log4j.rootLogger=WARN, stdout, R
log4j.rootLogger=DEBUG, stdout, R

# Make Apache classes quiet by default = ERROR = INFO = ERROR = FATAL = ERROR = ERROR = ERROR = ERROR = INFO = ERROR = ERROR

# Configure the stdout appender to go to the ConsoleLogHandler
# This will delegate to a WLS Catalog Logger and end up in the admin server log

# File Appender Added to logger
# Pattern to output the caller's file name and line number.


# Keep one backup file
