Logging applications with JPA

Logging supports viewing, tracing, and troubleshooting the runtime behavior of an application. Java™ Persistence API (JPA) provides a flexible logging system that is integrated with the application server to assist you in troubleshooting problems.

About this task

You can use logging to help troubleshoot problems.

Logging for EclipseLink
Supported trace strings for container-managed JPA applications
  • JPA=all

    Enables JPA container trace

  • eclipselink=all

    Enables all EclipseLink trace (ie: eclipselink.*=all)

  • EclipseLink specific log categories

    Trace strings specific to EclipseLink (ie: eclipselink.sql=all)

Supported trace strings for application-managed JPA applications:

When you run a JPA application that is application-managed, logging and tracing is controlled by the EclipseLink run time. All JPA tracing and logging must be configured through EclipseLink persistence properties in the persistence.xml file.

Notable logging persistence properties:
  • eclipselink.logging.parameters

    If “true”, SQL bind parameters are included in exceptions and logs.

Logging for OpenJPA
Supported trace strings for container-managed JPA applications
  • JPA=all

    Enables JPA container trace

  • OpenJPA=all

    Enables all OpenJPA trace (ie: openjpa.*=all)

  • OpenJPA specific log categories

    Trace strings specific to OpenJPA (ie: openjpa.jdbc.SQL=all)

Supported trace strings for application-managed JPA applications:

When you run a JPA application that is application-managed, logging and tracing is controlled by the OpenJPA run time. All JPA tracing and logging must be configured through OpenJPA persistence properties in the persistence.xml file.

Notable OpenJPA logging persistence properties:
  • openjpa.ConnectionFactoryProperties=PrintParameters=true

    If true, SQL bind parameters are included in exceptions and logs.

  • The openjpa.Log property is ignored if it is defined in a container-managed persistence unit the persistence providers that are provided with the application server. In this case, you must use the standard trace specification for the application server.
WSJPA-specific tracing information
Trace channels for WSJPA:
  • wsjpa.pdq

    Trace of all interactions between store manager and PDQ run time

  • wsjpa.Sqlgen

    Diagnostic trace for wsdbgen program

Procedure

In the persistence unit definition in the persistence.xml file, specify the logging level depending on the wanted level of logging details that you want. Specify the eclipselink.logging.level property where the value is the logging level. For the list of logging levels available, refer to the EclipseLink logging wiki page. The following example will turn on all logging that is available.
<persistence-unit name="pu">
        <properties>
           <property name="eclipselink.logging.level" value="ALL"/>
...
        </properties>
</persistence-unit>

주제 유형을 표시하는 아이콘 태스크 주제



시간소인 아이콘 마지막 업데이트 날짜: July 9, 2016 6:10
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tejb_loggingwjpa
파일 이름:tejb_loggingwjpa.html