Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-14001

Unable query logging of H2 database

XMLWordPrintable

    • Hide

      1. change the datasource setting:

      [hokuda@localhost configuration]$ diff -u standalone.xml standalone-h2query.xml 
      --- standalone.xml      2020-10-13 00:25:00.000000000 +0900
      +++ standalone-h2query.xml      2020-10-23 16:34:23.936987309 +0900
      @@ -152,7 +152,7 @@
               <subsystem xmlns="urn:jboss:domain:datasources:6.0">
                   <datasources>
                       <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
      -                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
      +                  <connection-url>jdbc:h2:${jboss.server.data.dir}/test;TRACE_LEVEL_FILE=4;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                           <driver>h2</driver>
                           <security>
                               <user-name>sa</user-name>
      

      2. deploy the attached jndi_datasource.war and start wildfly

      3. access http://localhost:8080/jndi_datasource/dstest

      Show
      1. change the datasource setting: [hokuda@localhost configuration]$ diff -u standalone.xml standalone-h2query.xml --- standalone.xml 2020-10-13 00:25:00.000000000 +0900 +++ standalone-h2query.xml 2020-10-23 16:34:23.936987309 +0900 @@ -152,7 +152,7 @@ <subsystem xmlns= "urn:jboss:domain:datasources:6.0" > <datasources> <datasource jndi-name= "java:jboss/datasources/ExampleDS" pool-name= "ExampleDS" enabled= " true " use-java-context= " true " statistics-enabled= "${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled: false }}" > - <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url> + <connection-url>jdbc:h2:${jboss.server.data.dir}/test;TRACE_LEVEL_FILE=4;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url> <driver>h2</driver> <security> <user-name>sa</user-name> 2. deploy the attached jndi_datasource.war and start wildfly 3. access http://localhost:8080/jndi_datasource/dstest
    • Undefined
    • ---
    • ---

      The connection-url is configured as follows with TRACE_LEVEL_FILE=4 to enable query logging:

      [hokuda@localhost configuration]$ diff -u standalone.xml standalone-h2query.xml 
      --- standalone.xml      2020-10-13 00:25:00.000000000 +0900
      +++ standalone-h2query.xml      2020-10-23 16:34:23.936987309 +0900
      @@ -152,7 +152,7 @@
               <subsystem xmlns="urn:jboss:domain:datasources:6.0">
                   <datasources>
                       <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
      -                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
      +                  <connection-url>jdbc:h2:${jboss.server.data.dir}/test;TRACE_LEVEL_FILE=4;DB_CL

      [hokuda@local{code}
      [hokuda@localhost configuration]$ diff -u standalone.xml standalone-h2query.xml
      — standalone.xml 2020-10-13 00:25:00.000000000 +0900
      +++ standalone-h2query.xml 2020-10-23 16:34:23.936987309 +0900
      @@ -152,7 +152,7 @@
      <subsystem xmlns="urn:jboss:domain:datasources:6.0">
      <datasources>
      <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">

      • <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
        + <connection-url>jdbc:h2:${jboss.server.data.dir}/test;TRACE_LEVEL_FILE=4;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
        <driver>h2</driver>
        <security>
        <user-name>sa</user-name>
        host configuration]$ diff -u standalone.xml standalone-h2query.xml 
         — standalone.xml 2020-10-13 00:25:00.000000000 +0900
         +++ standalone-h2query.xml 2020-10-23 16:34:23.936987309 +0900
         @@ -152,7 +152,7 @@
         <subsystem xmlns="urn:jboss:domain:datasources:6.0">
         <datasources>
         <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
         - <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
         + <connection-url>jdbc:h2:${jboss.server.data.dir}/test;TRACE_LEVEL_FILE=4;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
         <driver>h2</driver>
         <security>
         <user-name>sa</user-name>
        {code:java}
        OSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                             <driver>h2</driver>
                             <security>
                                 <user-name>sa</user-name>
        

        But, no query log is written in server.log.

              ropalka Richard Opalka
              rhn-support-hokuda Hisanobu Okuda
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: