Saturday, January 2, 2010

FAQ #8 - How to perform log analysis using the Diagnostic Log Analyzer in JDeveloper 11g


When it comes to diagnostics logging, a possibly lesser known feature of JDeveloper is its ability to perform log analysis. Known as the Oracle Diagnostic Log Analyzer, it allows the developer to open a diagnostics log file and do a limited yet useful log analysis. Let's see how it works.

Main Theme

To demonstrate this FAQ, let's create a sample Fusion Web Application (Web) based on the HR schema. Let's create an Employee entity from the EMPLOYEES table and an Employees view based on the Employee entity. Finally, let's bundle the Employees view in the HrAppModule application module.

For the ViewController let’s create a View Activity called Employees directly in the unbounded adfc-config task flow and an Employees.jspx JSF page for the Employees View Activity. Finally, let’s drag the Employees view from the HrAppModuleDataControl in the Data Controls and drop it onto the Employees.jspx JSF page as an ADF Form.

In order to generate detailed diagnostic log entries, bring up the ViewController Project Properties dialog and in the Run/Debug/Profile page select the Default run configuration and click Edit.... In Launch Settings specify -Djbo.debugoutput=console for the Java Options.

Save the project settings and run the application. Detailed log entries should have been generated in the JDeveloper Log console.

Take a look at the Actions menu at the top right of the Log window. Clicking on it will display a menu from which we can select Analyze Log | Current in Console.

Let's do just that - go ahead and select it. This will bring up the Oracle Diagnostic Log Analyzer window.

We will use the Diagnostic Log Analyzer to do some elementary analysis for the log generated while running the sample application. Select all of the log levels (Incident Error, Error, Warning, Notification, Trace and Unknown for ODL Log Levels) and search for the word "select" in the Message Text. All SELECT SQL statements will be identified in the log and displayed in the Results section.

To group the log messages by time period or by request, in the Related column, select either Related by Time or Related by Request.

What makes things a bit more interesting is the ability to load a log file generated by some other application or by another server - a WLS log file for example - into the Diagnostic Log Analyzer and do some analysis on it. Let's try it: click on the Browse Log Files icon and select a WLS log file to open. Then do some analysis on it.

Finally, note that the Oracle Diagnostic Log Analyzer is also available directly from the Tools menu.


Using the Oracle Diagnostic Log Analyzer in JDeveloper to perform log analysis could prove to be just another "little" tool that does a "big" job when dealing with the chaos of thousand-line diagnostics log files. It is simple and easy to use, so give it a try.

Until the next time, keep on JDeveloping!


No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...