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)
- JPA=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.
- eclipselink.logging.parameters
- 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)
- JPA=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 that uses the persistence providers that are provided with the application server. In this case, you must use the standard trace specification for the application server.
- openjpa.ConnectionFactoryProperties=PrintParameters=true
- 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
- wsjpa.pdq
Procedure
<persistence-unit name="pu">
<properties>
<property name="eclipselink.logging.level" value="ALL"/>
...
</properties>
</persistence-unit>