1

I used logging in persistence.xml for EclipseLink JPA implementation, from stackoverflow reference but the parameters appears as ? how can i show them properly in my glassfish log output window.

Community
  • 1
  • 1
shareef
  • 9,255
  • 13
  • 58
  • 89

1 Answers1

3

The log level configuration is included in the definition of the persistence unit in the persistence.xml file, as follows:

The logging of SQL parameters can be enabled, or disabled through the following properties:

Disable:

Enable:

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

full persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="ProjPU" transaction-type="JTA">
        <jta-data-source>jdbc/POS</jta-data-source>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>
        <properties>
            <property name="eclipselink.weaving" value="static" />
            <property name="eclipselink.logging.level.sql" value="FINEST" />
            <property name="eclipselink.logging.level" value="FINEST" />
            <property name="eclipselink.logging.level.cache" value="FINEST" />
            <property name="eclipselink.logging.parameters" value="true" />
        </properties>
    </persistence-unit>
</persistence>

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.

This property will also control how parameters are logged in exceptions. By default parameters are only logged for log level < CONFIG.

Refernce:Documentation,Wiki Ecipse link

shareef
  • 9,255
  • 13
  • 58
  • 89