How do I enable sql logging using DataNucleus with JBOSS 7.2

33 views Asked by At

I am trying to see all the sql queries generated by DataNucleus:

I am working with a legacy application that uses

        <datanucleus.version>5.1.11</datanucleus.version>
        <datanucleus.api.jpa.version>5.1.8</datanucleus.api.jpa.version>
        <datanucleus.persistence.version>2.1.0</datanucleus.persistence.version>

We are using a very old log4J:

        <log4j.version>1.2.16</log4j.version>

We are using JBOSS 7.2.2 (on Ubuntu with JDK1.8 if that matters)

I would like to following the instructions given in https://www.datanucleus.org/products/accessplatform/logging.html and record all the SQL generated. Following the instructions in Is it possible to intercept all DataNucleus' JDO SQL queries? led me to beleive that I need to do the following

log4j.category.DataNucleus=ALL

Unfortunately with JBOSS the logging.properties file is overwritten from an XML file. In that file I have placed the following with the hope that one of them will work

<logger category="log4j.category.DataNucleus">
            <level name="ALL"/>
</logger>
<logger category="category.DataNucleus">
            <level name="ALL"/>
</logger>
<logger category="DataNucleus">
            <level name="ALL"/>
</logger>

I don't get any SQL in the logs (or any DataNucleus messages)

I have also gone to the JBOSS admin console and manually set all the following to 'ALL'

  • log4j.category.DataNucleus
  • catagory.DataNucleus
  • DataNucleus
  • org.DataNucleus
  • log4j.category.DataNucleus.JDO
  • catagory.DataNucleus.JDO
  • DataNucleus.JDO
  • org.DataNucleus.JDO

I am still unable to see the SQL queries (or indeed any DataNucleus logging)

Could someone advise me of the magic strings I need to use. Either in the XML file, or manually using the admin console.

Thanks for your help

0

There are 0 answers