ADF Debugging : How to add custom log messages using adflogger

This post lists the steps to implement Logging in an ADF Application.
In this example, we use the ADFLogger utility to log messages to a custom file in weblogic server

Step 1 : ADFLogger configuration should be done in logging.xml file which is present in following path of weblogic server

for weblogic server integrated in jdeveloper, check for this file in C:\Documents and Settings\user\Application Data\JDeveloper\system11.\DefaultDomain\config\fmwconfig\servers\DefaultServer
open logging.xml in jdeveloper

step 2 :
This step is for logging messages in custom file (xx-diagnostic.log) ,instead of default ${weblogic.Name}-diagnostic.log file. This step can be omitted if you dont want messages in custom file

In structure window, expand log-handlers. check for log_handler with name ‘odl-handler’
create a copy of existing odl-handler.
change the name from odl-handler to some custom name ,say xx-handler.
in the property called path, change the default name ${domain.home}/servers/${weblogic.Name}/logs/${weblogic.Name}-diagnostic.log to ${domain.home}/servers/${weblogic.Name}/logs/xx-diagnostic.log

step 3 :
In the overview tab of logging.xml file,click on add symbol to add a persistent logger.
In the logger name select the class file or package for which you want to use this logger. example :
select a level based on the severity you need. Select Trace 32 for finest level.

step 4 : expand Root Logger and select the custom logger that is just created
expand the Handler Declarations below
select add button and select the the xx-handler.
if you dont want custom log file, omit this step and just select use parent handlers check box.

step 5 : Now select your project in jdeveloper.
Right click on project –> open project properties.
select Run/Debug/Profile.
In Run configurations , select the default configuration and edit
In launch settings–> Java Options , enter the following text.

With this the setup is completed. Now open the file (AM, bean or any java class) which belongs to above package and add log messages as shown in below sample file.

public class CustomAMImpl extends ApplicationModuleImpl implements CustomAM {
private static ADFLogger logger = ADFLogger.createADFLogger(CustomAMImpl.class);
public void logMessage()
logger.log("This method will be logged in the diagnostic log file");

Now you can see log messages in the log file.

JDev version used :

This entry was posted in ADF. Bookmark the permalink.

10 Responses to ADF Debugging : How to add custom log messages using adflogger

  1. mdev says:

    “change the name from odl-handler to some custom name ,say xx-handler.”

    WARNING: unable to read logging configuration from file ‘C:\Documents and Settings\Mann.MANGAL\Application Data\JDeveloper\system11.\DefaultDomain\config\fmwconfig\servers\DefaultServer\logging.xml’; exception: oracle.core.ojdl.logging.LoggingConfigurationException: ODL-52044: cannot find handler: odl-handler

    Why is it still searching for odl-handler?

    • Sowjanya Bhupathiraju says:

      Did you uncheck the ‘Use Parent Handlers’ check box. anyway its better to create a copy of original odl-handler and update it instead of replacing that.
      may be some other logger must be using the odl-handler and hence u must be getting this error

  2. Zsolt Horvath says:


    What is the benefit using ADFLogger versus log4j (or other logger utility)?

    Thanks: Zsolt

    • Sowjanya Bhupathiraju says:

      According to the following link (,

      “The main advantages of using Oracle Diagnostics Logging (ODL) when compared to other logging frameworks is its tight integration with WebLogic and JDeveloper. In WebLogic, the logs produced conform to and integrate with the diagnostics logging facility. Diagnostic logs include in addition to the message logged additional information such as the session and user that produced the log entry at run-time. This is essential when analyzing the logs. In JDeveloper the log configuration and analysis is integrated via the Oracle Diagnostics Logging Configuration and Oracle Diagnostics Log Analyzer respectively. “

  3. ks says:

    Hi I have created custom logger as mentioned by you by copying odl-handler and I changed its path and name and i used this new handler for my new package but my logs were not printed in new logs file and they were printed in console as i also used console-handler… Please Solve this problem asap…. Thanks a ton…

  4. Sowjanya Bhupathiraju says:

    Hi ks,
    I hope you have done the following as explained.

    if still its not woring, I might have to check the changes you did, without which I cannot tell you where it went wrong!

  5. Howdy! Someone in my Myspace group shared this site with us
    so I came to give it a look. I’m definitely enjoying the information. I’m bookmarking and will be tweeting this to my followers!

    Outstanding blog and brilliant design and style.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s