4 Replies Latest reply on Oct 22, 2014 10:29 AM by alkhan

    Why jdbc logs isn't working

    alkhan

      Hi,

       

      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.


      So, I try to activate JDBC logs into wildfly:

      I added to my standalone.xml in subsystem "urn:jboss:domain:logging:2.0":


      <logger category="jboss.jdbc.spy">

         <level name="TRACE"/>

      </logger>

       

      and in my datasource statement : spy="true"

       

      It seems to work when I start the server, but not when the server is started by arquillian

      any ideas ?


      Best regards

        • 1. Re: Why jdbc logs isn't working
          bmajsak

          Does it work when you deploy your application normally (not through Arquillian)?

          • 2. Re: Why jdbc logs isn't working
            alkhan

            With a normal deployement:
            The logger of EclipseLink does not work, but jboss.jdbc.spy works.

            Through Arquillian:
            The logger of EclipseLink and jboss.jdbc.spy do not work.

            • 3. Re: Why jdbc logs isn't working
              bmajsak

              How is your test setup? Managed container? Can you share your dependencies, test class and arquillian.xml?

               

              Cheers,

              Bartosz

              • 4. Re: Why jdbc logs isn't working
                alkhan

                My Test:

                @RunWith(Arquillian.class)

                public class TestProp {

                 

                    @Inject

                    private PropertiesDAO propDao;

                 

                    @Deployment

                    public static WebArchive createDeployment() {

                        return ShrinkWrap.create(WebArchive.class, "test.war").addPackages(true, "com.test")

                                .addAsResource("test-persistence.xml", "META-INF/persistence.xml");

                    }

                 

                    @Test

                    public void testGetProperties() {

                        List<Properties> lst = this.propDao.getProperties();

                        assertTrue("No properties found", lst.size() > 1);

                    }

                }

                 

                My arquillian.xml :

                <?xml version="1.0" encoding="UTF-8"?>

                <arquillian xmlns="http://jboss.org/schema/arquillian"

                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                    xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

                    <engine>

                        <property name="deploymentExportPath">target/arquillian</property>

                    </engine>

                    <container qualifier="wildfly" default="true">

                        <configuration>

                            <property name="jbossHome">C:/wildfly-8.1-test</property>

                            <property name="modulePath">C:/wildfly-8.1-test/modules</property>

                        </configuration>

                    </container>

                </arquillian>

                 

                In my pom.xml:

                <dependencies>
                   <dependency>
                   <groupId>org.eclipse.persistence</groupId>
                   <artifactId>eclipselink</artifactId>
                   <version>${eclipselink.version}</version>
                   <scope>provided</scope>
                   </dependency>
                   <dependency>
                   <groupId>org.eclipse.persistence</groupId>
                   <artifactId>javax.persistence</artifactId>
                   <version>${javax.persistence.version}</version>
                   <scope>provided</scope>
                   </dependency>
                   <dependency>
                   <groupId>org.eclipse.persistence</groupId>
                   <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
                   <version>${eclipselink.version}</version>
                   <scope>provided</scope>
                   </dependency>
                   <dependency>
                   <groupId>org.javassist</groupId>
                   <artifactId>javassist</artifactId>
                   <version>3.18.1-GA</version>
                   </dependency>

                 

                   <!-- test -->
                   <dependency>
                   <groupId>org.eu.ingwar.tools</groupId>
                   <artifactId>arquillian-suite-extension</artifactId>
                   <version>${arquillian.suite.extension.version}</version>
                   <scope>test</scope>
                   </dependency>
                   <dependency>
                   <groupId>org.jboss.arquillian</groupId>
                   <artifactId>arquillian-bom</artifactId>
                   <version>${arquillian.version}</version>
                   <type>pom</type>
                   </dependency>
                   <dependency>
                   <groupId>org.jboss.arquillian.extension</groupId>
                   <artifactId>arquillian-transaction-api</artifactId>
                   <scope>test</scope>
                   </dependency>
                   <dependency>
                   <groupId>org.jboss.arquillian.extension</groupId>
                   <artifactId>arquillian-transaction-impl-base</artifactId>
                   <scope>test</scope>
                   </dependency>
                   <dependency>
                   <groupId>org.jboss.arquillian.extension</groupId>
                   <artifactId>arquillian-transaction-spi</artifactId>
                   <scope>test</scope>
                   </dependency>
                   <dependency>
                   <groupId>org.jboss.arquillian.extension</groupId>
                   <artifactId>arquillian-transaction-jta</artifactId>
                   <scope>test</scope>
                   </dependency>
                   <dependency>
                   <groupId>org.jboss.arquillian.junit</groupId>
                   <artifactId>arquillian-junit-container</artifactId>
                   <scope>test</scope>
                   </dependency>
                   <dependency>
                   <groupId>junit</groupId>
                   <artifactId>junit</artifactId>
                   <version>${junit.version}</version>
                   <scope>test</scope>
                   </dependency>

                    </dependencies>

                    <profiles>

                   <profile>
                   <id>arquillian-wildfly-embedded</id>
                   <activation>
                   <activeByDefault>true</activeByDefault>
                   </activation>
                   <dependencies>
                   <dependency>
                   <groupId>org.wildfly</groupId>
                   <artifactId>wildfly-arquillian-container-embedded</artifactId>
                   <version>8.1.0.Final</version>
                   </dependency>
                   <dependency>
                   <groupId>org.wildfly</groupId>
                   <artifactId>wildfly-embedded</artifactId>
                   <version>8.1.0.Final</version>
                   </dependency>
                   <dependency>
                   <groupId>com.h2database</groupId>
                   <artifactId>h2</artifactId>
                   <version>${h2.version}</version>
                   <scope>test</scope>
                   </dependency>
                   </dependencies>
                   <build>
                   <testResources>
                   <testResource>
                   <directory>src/test/resources</directory>
                   </testResource>
                   </testResources>
                   <plugins>
                   <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-surefire-plugin</artifactId>
                   <version>${maven.surefire.plugin.version}</version>
                   </plugin>
                   </plugins>
                   </build>
                   </profile>

                    </profiles>

                 

                Thanks for you help !