Search code examples
jpaloggingeclipselink

How do I properly setup SQL logging for EclipseLink?


I want to see the generated SQL statements from EclipseLink. The persistence.xml contains the following properties:

<properties>
  <property name="eclipselink.logging.file"        value="/workspace/logs/JPA.log" />
  <property name="eclipselink.logging.level"       value="ALL" />
  <property name="eclipselink.logging.level.sql"   value="ALL" />
  <property name="eclipselink.logging.logger"      value="JavaLogger"/>
  <property name="eclipselink.logging.parameters"  value="true"/>
  <property name="javax.persistence.jdbc.driver"   value="org.mariadb.jdbc.Driver" />
  <property name="javax.persistence.jdbc.url"      value="jdbc:mariadb://192.168.178.42:3306/halsol" />
  <property name="javax.persistence.jdbc.user"     value="user" />
  <property name="javax.persistence.jdbc.password" value="pw" />
  <property name="jdbc.persistence.logging"        value="true" />
  <property name="jdbc.persistence.logfile"        value="/workspace/logs/JDBC.log" />
</properties>

The file "JPA.log" gets generated (as well as JDBC.log) but is has no contents after loading some rows from the database. I'm using EclipseLink 2.5.


Solution

  • I tried the same properties you have, it should work if you remove the following line:

    <property name="eclipselink.logging.logger"      value="JavaLogger"/>