Configuring and Using the WebLogic Diagnostics Framework
The only WebLogic Diagnostic Framework (WLDF) component you can use with applications is Instrumentation. See Configuring Application-Scoped Instrumentation.
You configure and manage instrumentation for an application as a diagnostics application module, which is an application-scoped resource. The configuration is persisted in a descriptor file which you deploy with the application. A diagnostic module deployed in this way is available only to the enclosing application. Using application-scoped resources ensures that an application always has access to required resources and simplifies the process of deploying the application to new environments.
Note: For instrumentation to be available for an application, instrumentation must be enabled on the server to which the application is deployed. (Server-scoped instrumentation is enabled and disabled in the
<instrumentation> element of the diagnostics descriptor for the server.)
To deploy a diagnostic module as an application-scoped resource, you configure the module in a descriptor file named
weblogic-diagnostics.xml. Then you package the descriptor file with the application archive in the
/META-INF directory for the deployed application (for example,
D:\bea\weblogic91\samples\server\medrec\medrecEar). You can deploy the diagnostic module in both exploded and unexploded archives.
For information on creating modules and deploying applications, see Deploying Applications to WebLogic Server.
Because of the different ways that diagnostic application modules and diagnostic system modules are deployed, there are some differences in how you can reconfigure them and when those changes take place, as shown in Table 13-1. The details of how to work with diagnostic application modules is described throughout this section. See Configuring Instrumentation, for information about working with diagnostic system modules.
Yes, when hot swap1 is enabled
WebLogic Server supports deployment plans, as specified in the J2EE Deployment Specification API (JSR-88). With deployment plans, you can modify an application's configuration after the application is built, without having to modify the application archives. For complete documentation on using deployment plans in WebLogic Server, see Configuring Applications for Production Deployment in Deploying Applications to WebLogic Server.
If you want to reconfigure an application that was deployed without a deployment plan, you must undeploy, unarchive, reconfigure, rearchive, and then redeploy the application. With a configuration plan, you can dynamically change many configuration options simply by updating the plan, without modifying the application archive.
If you enable a feature called "hot swap" (see Enabling Hot-Swap Capabilities) before deploying your application with a deployment plan, you can dynamically update all instrumentation settings, without redeploying the application. If you do not enable hot swap, or if you do not use a deployment plan, changes to some instrumentation settings require redeployment, as shown in Table 13-2.
Must redeploy application1
It is recommended that you create an empty descriptor. That provides full flexibility for dynamically modifying the configuration. It is possible to create monitors in the original descriptor file and then use a deployment plan to override the settings. However, you will not be able to completely remove monitors without redeploying. If you add monitors using a deployment plan to an empty descriptor, all such monitors can be removed. For information about configuring diagnostic application modules, see Configuring Application-Scoped Instrumentation.
weblogic-diagnostics.xml, in the top-level
META-INFdirectory of the appropriate archive.
PlanGenerator tool inspects all J2EE deployment descriptors in the selected application, and creates a deployment plan with null variables for all relevant WebLogic Server deployment properties that configure external resources for the application.
For more information about creating and using deployment plans, see Configuring Applications for Production Deployment in Deploying Applications to WebLogic Server.
For more information about using
PlanGenerator, see weblogic.PlanGenerator Command Line Reference and Exporting an Application for Deployment to New Environments in Deploying Applications to WebLogic Server.
Listing 13-1 shows a simple deployment plan generated using
weblogic.PlanGenerator. (For readability, some information has been removed.) The plan enables the
Servlet_Before_Service monitor and attaches to it the actions
<!-- Add two additional actions to Servlet_Before_Service monitor -->
<-- Enable the Servlet_Before_Service monitor -->
For a list and documentation of diagnostic monitors and actions that you can specify in the deployment plan, see WLDF Instrumentation Library.
You can use any of the standard WebLogic Server tools for controlling deployment, including the Administration Console or the WebLogic Scripting Tool (WLST). For example, the following WLST command deploys an application with a corresponding deployment plan.
After deployment, the effective diagnostic monitor configuration is a combination of the original descriptor, combined with the overridden attribute values from the plan. If the original descriptor did not include a monitor with the given name and the plan overrides an attribute of such a monitor, the monitor is added to the set of monitors to be used with the application. This way, if your application is built with an empty
weblogic-diagnostics.xml descriptor, you can add diagnostic monitors to the application during or after the deployment process, without having to modify the application archive.
You change configuration settings by modifying the deployment plan and then updating or redeploying the application, depending on whether or not hot swap is enabled. (See Table 13-2 to see when you can simply update the application and when you must redeploy it.) You can use any of the standard WebLogic Server tools for updating or redeploying, including the Administration Console or the WebLogic Scripting Tool (WLST).
If you enabled hot-swap, you can update the configuration for the application with the modified plan values by updating the application with the plan. For example, the following WLST command updates an application with a plan: