Thursday, February 21, 2013

ADF Logger (ADFLogger)

As per Duncan, install the logging template in JDeveloper. To install these:
  1. Open  Tools --> Preferences from the JDeveloper menu
  2. Expand the Code Editor --> Code Templates node in the preferences navigator
  3. Select the More Actions --> Import menu option as shown here and import the loggingTemplates.xml file from the File Cabinet.

Now say you have defined a class while developing an application in ADF. So inside the class, type 'lgdef' and press Ctrl+Enter. This will create a logging object automatically with the name _logger.
private static ADFLogger _logger = ADFLogger.createADFLogger(BCPagingMB.class);
In the above example, BCPagingMB is the name of the class.

Now wherever you were using sop statement, type 'lgi', press Ctrl+Enter, enter the message that you want to display.

Then in the IntegratedWebLogicServer Log, click on Actions and go to Configure Oracle Diagnostic Logging. Now I had written the code in the view package. So search for view in the RootLogger tree. Select it. Click the plus button to add a Transient Logger. Enter the Logger name as the name of the package (in this case, view), and set the logger level as Info.

You can read more about ADFLogger in Duncan Mills's blog.

No comments:

Post a Comment