2

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.

akhilless
  • 3,169
  • 19
  • 24
Jemolah
  • 1,962
  • 3
  • 24
  • 41

2 Answers2

2

The eclipselink.logging.logger parameter is provided for overriding default eclipselink logger.
Try either not setting this property or setting up java.util.logging within your application.

  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment). – Mihai Maruseac Dec 15 '14 at 13:12
  • 4
    I disagree, removing the property as I suggested is one way to resolve the issue, and another way is using the property but also setting up java.util.logging within the application.Mentioning the reason why the parameter is provided is meant as a clarification as to why the above solution does not work. I had no intention to criticise with my post. – Petros Splinakis Dec 15 '14 at 13:23
2

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

<property name="eclipselink.logging.logger"      value="JavaLogger"/>
dalia
  • 146
  • 4
  • 1
    I get console logging output. The property "jdbc.persistence.logfile" is not used. The file is not created. Do you have any idea how I can redirect the output to a file? – Jemolah Jan 24 '15 at 12:53
  • Found it. I have replaced "jdbc.persistence.logfile" with "eclipselink.logging.file". Thx – Jemolah Jan 24 '15 at 12:56