Adventures in ADF Logging - Part 4
By Duncan Mills-Oracle on Jun 10, 2011
Viewing The Results of Your Hard Work
Previously in this series we've seen how you can instrument your code and then subsequently switch logging on using the configuration editor for logging.xml. However, so far we've just looked at that output in the console / log window of JDeveloper which is OK in the simple debugging scenario but really is a pale comparison with what we could be doing here.
Recall from the previous installment of this series, that the root logger defines several handlers for the log output and that console was on that list. Well another handler on that list is the odl-hander - the Oracle Diagnostic Logging (ODL) utility. Let's look at how we can use that to get a bit more information out of the logging that we've painstakingly added to our code.
JDeveloper has a build in viewer for the ODL logs which you can simply get to from the Tools > Oracle Diagnostic Log Analyzer menu option, or from the drop down menu in the log window:
You'll see that in the case of the Action Menu we have a shortcut to just open the log for the current session which is what you need most of the time, however, you can also select any ODL diagnostic log (from any WebLogic instance, not just the integrated WLS) and diagnose that.
Now The Power is Yours
The ODL Analyzer will now appear and you can start to play. Note that once the ODL Analyzer is open you can click the magnifying glass icon at the top of the screen to browse the file system for other logs. The file dialog that comes up already has a shortcut for you pointing to the WLS log directory of the integrated container:
In this case I'm viewing the current log and I've filtered it to just show me logging generated in the last hour and coming from the oracle.demo.whippet package. However, you can see that there is a lot of filtering that you can do to slice and dice your logs:
Notice that there are two tabs in the ODL Analyzer, make sure the one labelled By Log Message is selected at this stage.
This window actually has a detail view which in this case is collapsed below the table of log entries. That will give you more information about the selected log entry such as the authenticated user and more detail such as the stack trace if you logged a Throwable.
You can control the columns displayed in the table using the small downwards facing arrow above the right hand scrollbar. Next have a play with the Related pulldown . Click this for a particular log entry and this will present 3 options:
- Related By Request - will filter the view to just show the logging entries that came out of the same HTTP Request
- Related By Time - will filter the view to a specified timeslice (you'll get a pull-down to allow you to define how long back in time you want to look before the specified entry. The default is 30 seconds). This can be really handy when other things are happening on the system which may well be part of a separate request but impact the thing you are trying to diagnose - for example, an af:poll kicks off a PPR request that you were not expecting.
- Related By ADF Request - This one we'll cover in the next article in this series
So as you can see, the ODL analyzer gives you a lot of power to both filter your logging output and start to logically trace what's happening within your application. Next time though I'll look at what happens when we incorporate that information into the context of the ADF Lifecyle. That's when things get extremely exciting.