Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JPA Logging Level on Glassfish v3 Server

<property name="eclipselink.logging.level" value="FINE" />

How can I setup the logging level by server. I want to see Level.FINE on my development server. But of course only Level.WARNING on the productive server.

If I put the line above into the persistence.xml then it is automatically setup on both machines. I must remember to switch it off by hand. And that's of course dangerous.

Thanks a lot.

like image 724
Hasan Tuncay Avatar asked Oct 18 '12 12:10

Hasan Tuncay


2 Answers

I have been struggling with this myself. What I have discovered is that on GlassFish (at leas on 3.1.2) you edit the logging.properties file from the GlassFish domains/domain/config directory.

Locate the org.eclipse.persistence.session.level entry and change it as follows:

org.eclipse.persistence.session.level=FINE

In addition to this, I have found I need to add these two entries:

org.eclipse.persistence.level = FINE
org.eclipse.persistence.sql.level = FINE

When editing the logging.properties file like this, there is no need to add anything to the persistence.xml file regarding logging, and it will satisfy your requirements above.

NOTE: I have not yet managed to get the eclipselink.logging.parameter=true to work in the persistence.xml (it is not assignable in the logging.properties). So the SQL logging works, just not with the full bindings dump.

like image 26
Armand Avatar answered Oct 19 '22 22:10

Armand


You can refer EclipseLink/Examples/JPA/Logging

Note: Setting eclipselink.logging.level to FINE is not sufficient (as of EclipseLink 2.4.0 - Juno), you have to set eclipselink.logging.level.sql to FINE.

<property name="eclipselink.logging.level" value="FINE"/>
<property name="eclipselink.logging.level.sql" value="FINE"/>
<property name="eclipselink.logging.parameters" value="true"/>
like image 177
Amit Deshpande Avatar answered Oct 19 '22 22:10

Amit Deshpande