Hasan Tuncay
Hasan Tuncay

Reputation: 1108

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.

Upvotes: 5

Views: 3460

Answers (3)

Armand
Armand

Reputation: 503

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.

Upvotes: 3

Hasan Tuncay
Hasan Tuncay

Reputation: 1108

I added these lines into the logging.properties file and it works without adding it to the persistence.xml. So it is server depended now.

eclipselink.logging.level=FINE
eclipselink.logging.level.sql=FINE
eclipselink.logging.parameters=true

Upvotes: 0

Amit Deshpande
Amit Deshpande

Reputation: 19185

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"/>

Upvotes: 5

Related Questions