Network Deployment (Distributed operating systems), v8.0 > Troubleshoot and support > Troubleshoot EJB applications > Troubleshoot JPA applications > Log applications with JPA


Enable enhanced tracing for JPA

In some situations the trace information generated by the Java Persistence API (JPA) providers shipped with WAS might not be adequate to diagnose a problem. In these situations, an extended trace mechanism can be enabled to generate additional information in the trace file. Extended trace can function only with IBM-shipped persistence providers. It does not work with third-party providers, including alternate versions of OpenJPA bundled within an application or configured as a shared library.

New feature: Beginning in WAS v8.0 you can configure the server to use the High Performance Extensible Logging (HPEL) log and trace infrastructure instead of using SystemOut.log , SystemErr.log, trace.log, and activity.log files or native z/OS logging facilities. If you are using HPEL, you can access all of your log and trace information using the LogViewer command-line tool from your server profile bin directory. See the information about using HPEL to troubleshoot applications for more information on using HPEL.New feature:

Enable enhanced tracing in a WAS environment

Enhanced JPA tracing for an application running on WAS can be enabled with a few simple steps using wsadmin scripting or the administration console. The steps in this topic describe how to configure enhanced tracing using the administration console. This process changes server settings, so it is good practice to back up your server configuration before proceeding.


Procedure

  1. Enable the trace agent. A trace agent must be enabled per application server by passing an argument to the server Java Virtual Machine (JVM). The trace agent can be enabled using the admin console by following these steps:

    1. In the navigation pane, select Servers. Select Application Servers.

    2. In the server list pane, select the server that needs the enhanced JPA trace. If multiple servers provide JPA functionality to the application, these steps must be followed for every server.

    3. Under the Server Infrastructure heading, select Java and Process Management. Select Process Definition.

    4. Under the Additional Properties heading, select Java virtual machine.

    5. Add the following argument to the Generic JVM arguments field, where WAS_HOME is the fully qualified path of your application server installation directory. Make sure to use the path separator character appropriate for your operating system.
      -javaagent:
      WAS_HOME/optionalLibraries/IBM/wsjpa/wsjpatrace.jar
      

      The use of generic JVM arguments in the administrative console does not currently support spaces within arguments. If spaces are specified in this field, the server can fail to start. This is more likely to occur in a Windows environment because the default installation path is C:\IBM\WebSphere\AppServer, which contains a space in the path.

      To work around this problem in a Windows environment use an abbreviated path name for the WAS_HOME. For example, C:\Progra~1\IBM\WebSphere|AppServer. On UNIX-type systems a symbolic link can be used to eliminate spaces in the WAS_HOME. For example, if the WAS installation path is/opt/WAS_HOME/AppServer, a symbolic link can be created in /opt from WAS_HOME to AppServerRoot, eliminating the space. Then, specify /opt/AppServerRoot/AppServer as the WAS_HOME in the generic JVM argument.

  2. Enable additional trace components and adjust trace file options. We can accomplish this step with wsadmin scripting or the administration console. These steps describe how to adjust trace file settings and enable components using the administration console:

    1. In the navigation pane, select Troubleshooting. Click Logs and Trace.

    2. Select the name of the server to trace.
    3. Under General Properties, select Diagnostic Trace.

    4. Make sure Enable Log is checked and optionally increase the Maximum File Size and Maximum Number of Historical Files. Depending on the number of additional trace categories and the trace levels chosen, the trace file can become large.

    5. Under the Additional Properties heading, select Change Log Detail Levels.
    6. Enable various extended trace categories by specifying one or more trace categories from the following table. An example trace string is: *=info:JPA=all:openjpa.*=finer:openjpa.kernel=finest. Extended trace traces at the FINER or FINEST trace levels. The FINEST level includes more detail than FINER. When ALL is specified, extended trace traces at the FINEST level.

      Trace categories. Back up your server configuration before you enable enhanced tracing.

      Category Relevant trace levels Description
      JPA OFF, ALL, FINER, FINEST Add extended trace to the JPA trace group.
      openjpa.* OFF, ALL, FINER, FINEST Normal OpenJPA trace in addition to extended trace for all categories in OpenJPA when extended trace is enabled.
      openjpa.xtrace.* OFF, ALL, FINER, FINEST Extended trace for all categories in OpenJPA when extended trace is enabled.
      openjpa.xtrace.Jdbc OFF, ALL, FINER, FINEST Extended trace for OpenJPA JDBC classes when extended trace is enabled.
      openjpa.xtrace.Lib OFF, ALL, FINER, FINEST Extended trace for OpenJPA library classes when extended trace is enabled.
      openjpa.xtrace.Persist OFF, ALL, FINER, FINEST Extended trace for OpenJPA persistence classes when extended trace is enabled.
      openjpa.xtrace.Kernel OFF, ALL, FINER, FINEST Extended trace for OpenJPA kernel classes when extended trace is enabled.
      openjpa.xtrace.General OFF, ALL, FINER, FINEST Extended trace for OpenJPA classes not included in the JDBC, Lib, Persist, or Kernel categories when extended trace is enabled.
      openjpa.xtrace.ApiSpi OFF, ALL, FINER, FINEST Extended trace for public API/SPI interfaces defined for WsJPA, OpenJPA, and JPA when extended trace is enabled.

  3. Save the application server configuration and restart the application server.


Results

After you restart the application server, the new trace settings are used.


What to do next

Tracing can degrade performance significantly and should be disabled when not in use. To disable trace, remove the Generic JVM argument and any trace detail levels added for enhanced tracing.
Log applications with JPA

+

Search Tips   |   Advanced Search