2 Replies Latest reply: Apr 22, 2010 1:59 AM by Steve Button-Oracle RSS

    log4j Configuration in Standalone Weblogic Server - ADF


      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, log4j.properties or log4j.xml, log4j-1.2.15.jar, wllog4j.jar
      This configuration is done using log4j.properties file.
      log4j.properties 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 log4j.properties 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\log4j.properties
      set SAVE_JAVA_OPTIONS=%JAVA_OPTIONS% -Dlog4j.configuration=%LOG4J_CONFIG_FILE%

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

      By the above steps, I have configured the log4j.properties 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 log4j.properties 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


      ---- Log4j.properties 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
      log4j.logger.org.apache = ERROR
      #log4j.logger.org.apache.beehive.netui.pageflow = INFO
      log4j.logger.org.apache.beehive.netui.pageflow.scoping.internal = ERROR
      log4j.logger.org.apache.beehive.netui.pageflow.internal.AdapterManager = FATAL
      log4j.logger.com.bea.console.utils.MasterControlProgram = ERROR
      log4j.logger.com.bea.console.utils.ConsoleMessagesBackingFile = ERROR
      log4j.logger.com.bea.console.actions.messages.MessagesAction = ERROR
      log4j.logger.com.bea.console.actions.BaseConsoleAction = ERROR
      #log4j.logger.com.bea.console.utils.UsageRecorder = INFO
      log4j.logger.com.bea.console.actions = ERROR
      log4j.logger.com.bea.console.utils = 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.
      log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n


      # Keep one backup file

      log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n