How do I configure OpenJPA SQL logging?

user1400965 picture user1400965 · May 24, 2012 · Viewed 19.6k times · Source

What is the OpenJPA configuration to view SQL query executed in a database? I would like to view the query with all parameters executed in log or console instead of viewing the JPQL query

Answer

Rick picture Rick · May 24, 2012
<property name="openjpa.Log" value="SQL=Trace" />

Enables logging of all SQL statements, minus parameter values.

<property name="openjpa.ConnectionFactoryProperties" value="PrintParameters=true" />

Enables logging of SQL parameters.

Logging documentation