Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to activate JDBC logs in wildfly

I use wildfly with EclipseLink and I want to trace SQL statements. I configured EclipseLink according to documentation, all work fine except the SQL logs. I added these properties in my persistence.xml:

    <properties>
        <property name="eclipselink.logging.level.sql" value="FINE" />
        <property name="eclipselink.logging.parameters" value="true" />
        <property name="eclipselink.debug" value="OFF" />
        <property name="eclipselink.weaving" value="static" />
        <property name="eclipselink.logging.logger" value="DefaultLogger" />
    </properties>

but no SQL logs. What am I doing wrong?

like image 671
Seb Avatar asked Oct 20 '14 13:10

Seb


1 Answers

Here is the what works for me. I'm using Wildfly 8.2.0, eclipselink 2.5.1.

Just add

        <logger category="org.eclipse.persistence.sql">
            <level name="DEBUG"/>
        </logger>

        <logger category="org.jboss.as.jpa">
            <level name="DEBUG"/>
        </logger>

to logging subsystem, in standalone.xml (in the configuration folder).

Just between

<subsystem xmlns="urn:jboss:domain:logging:2.0">

......

</subsystem>

The logging level for console handler should be at least set to DEBUG, like this:

        <console-handler name="CONSOLE">
            <level name="DEBUG"/>
            <formatter>
                <named-formatter name="COLOR-PATTERN"/>
            </formatter>
        </console-handler>

The same for file-handler.

Good luck.

like image 195
Xiaodong Xie Avatar answered Nov 14 '22 23:11

Xiaodong Xie