Application Instrumentation with WebLogic Diagnostic Framework (WLDF)

March 23, 2007 – 7:18 pm

The WebLogic Diagnostic Framework, while powerful, is not the easiest beast to work with. After a couple of days of messing around with it, I finally figured out how to instrument my application code's methods.

Unless you are the type that reads manuals front-to-back before you embark on a task, you may not have figured out that you need to enable Application Instrumentation when you deploy the application. Also, contrary to intuition, you don't configure application instrumentation in the Diagnostics section of the WebLogic admin console, but instead in the web application deployment configuration settings.

Now that we've figured this out, let's go to the deployment configuration. Edit the deployment and choose the 'Instrumentation' section of the 'Configuration' tab. Now, if there isn't a weblogic-diagnostics.xml file in the webapp's META-INF directory, you won't be able to configure anythign. So, let's put one there. Here is an empty sample weblogic-diagnostics.xml you can start with:

	<wldf-resource xmlns="http://www.bea.com/ns/weblogic/90/diagnostics"
	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	 xsi:schemaLocation="http://www.bea.com/ns/weblogic/90/diagnostics.xsd">
		<instrumentation>
			<enabled>true</enabled>
		</instrumentation>
	</wldf-resource>
	

Now, put this weblogic-diagnostics.xml file in your webapps META-INF, redeploy the application, and you can start to instrument.

Let's look at a common example of instrumentation, capturing method response times. In this case you would use a point cut like the following:

	Action: TraceElapsedTimeAction
	Location-type: Around
	Pointcut: execution(* +com.myorg.interface.* *(...))

That's it!

  1. One Response to “Application Instrumentation with WebLogic Diagnostic Framework (WLDF)”

  2. Thank you very much. This is what I was looking for.

    By Vijay on Aug 1, 2008

Post a Comment