You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by twelveeighty <tw...@gmail.com> on 2012/08/13 00:48:46 UTC

TomEE openJPA logging not working

I am stuck trying to get openJPA to log its openjpa.jdbc.SQL statements. No
matter what I try, I can't seem to bump up the log level for openJPA.
Ideally, I'd like to have those logged to my log4j configuration, but at
this point, I'll settle for ANY solution that will have me see those log
entries.

My app is an "all in one" WAR, as described in
http://openejb.apache.org/deploying-in-tomee.html.

Here's what I tried so far:

LOG4J:
I have a logging.properties file in the <tomee>/lib folder. In it, I use:
log4j.category.openjpa.jdbc.SQL=DEBUG

This is alongside my other log settings, which are working fine:
log4j.category.<myroot>=DEBUG, where <myroot> is the root package for my own
code.

For the deployed app, in the META-INF/persistence.xml, I have defined:
<property name="openjpa.Log" value="log4j"/>

This doesn't work. All I see in the catalina.out console log is the two
statements:
INFO - Starting OpenJPA 2.2.0
INFO - Using dictionary class
"org.apache.openjpa.jdbc.sql.PostgresDictionary".

But nothing in my log4j log.

JDK LOG:

For this, I added the following to the <tomee>/conf/logging.properties:
openjpa.jdbc.SQL.level=ALL

And then in my persistence.xml, I use:
<property name="openjpa.Log" value="commons"/>

This also doesn't work.

I am able to use openJPA logging in log4j with the described method on
"vanilla" Tomcat 7 with openJPA, so I do not think this is a problem with
openJPA.

Can someone point me in the right direction? Thanks!



--
View this message in context: http://openejb.979440.n4.nabble.com/TomEE-openJPA-logging-not-working-tp4656828.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: TomEE openJPA logging not working

Posted by twelveeighty <tw...@gmail.com>.
No, I'm all for keeping lib/ as lean as possible too. I just wanted to make
sure it wasn't a packaging bug. I can easily add it back to <tomee>/lib or
to my WEB-INF/lib - which, by the way, is a discussion all by itself.


Romain Manni-Bucau wrote
> 
> We try to put as few as libraries as possible without forking anything so
> i
> think aopalliance is no kore here because of a library cleanup.
> 
> Is it an issue?
> 
> 




--
View this message in context: http://openejb.979440.n4.nabble.com/TomEE-openJPA-logging-not-working-tp4656828p4656864.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: TomEE openJPA logging not working

Posted by Romain Manni-Bucau <rm...@gmail.com>.
We try to put as few as libraries as possible without forking anything so i
think aopalliance is no kore here because of a library cleanup.

Is it an issue?

- Romain
Le 14 août 2012 04:49, "twelveeighty" <tw...@gmail.com> a écrit :

> YES!, I tested my app against this 1.1.0 snapshot release and it works as
> expected in 1.1.0.
>
> When is 1.1.0 going RTM / release?
>
> By the way, I noticed that in 1.1.0, the aopalliance-1.0.jar library is no
> longer in the lib/ folder. Since I use Spring in my app to inject EJBs into
> my Struts2 action classes, I had to add this jar, or otherwise I would get
> "java.lang.NoClassDefFoundError:
> org/aopalliance/intercept/MethodInterceptor
> exceptions." Not sure if this lib was removed by design. I can start a
> separate thread on this if needed.
>
>
> Romain Manni-Bucau wrote
> >
> > you can greab this snapshot:
> >
> https://repository.apache.org/content/groups/snapshots/org/apache/openejb/apache-tomee/1.1.0-SNAPSHOT/apache-tomee-1.1.0-20120812.041045-102-plus.zip
> >
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/TomEE-openJPA-logging-not-working-tp4656828p4656852.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: TomEE openJPA logging not working

Posted by twelveeighty <tw...@gmail.com>.
YES!, I tested my app against this 1.1.0 snapshot release and it works as
expected in 1.1.0.

When is 1.1.0 going RTM / release?

By the way, I noticed that in 1.1.0, the aopalliance-1.0.jar library is no
longer in the lib/ folder. Since I use Spring in my app to inject EJBs into
my Struts2 action classes, I had to add this jar, or otherwise I would get
"java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor
exceptions." Not sure if this lib was removed by design. I can start a
separate thread on this if needed.


Romain Manni-Bucau wrote
> 
> you can greab this snapshot:
> https://repository.apache.org/content/groups/snapshots/org/apache/openejb/apache-tomee/1.1.0-SNAPSHOT/apache-tomee-1.1.0-20120812.041045-102-plus.zip
> 



--
View this message in context: http://openejb.979440.n4.nabble.com/TomEE-openJPA-logging-not-working-tp4656828p4656852.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: TomEE openJPA logging not working

Posted by Romain Manni-Bucau <rm...@gmail.com>.
you can greab this snapshot:
https://repository.apache.org/content/groups/snapshots/org/apache/openejb/apache-tomee/1.1.0-SNAPSHOT/apache-tomee-1.1.0-20120812.041045-102-plus.zip

a quick patch can be to switch the logger factory if i remember the issue
replacing the old one by the new one (can be done in a separate jar if you
prefer this solution).

- Romain


2012/8/13 twelveeighty <tw...@gmail.com>

> Yes, I am using apache-tomee-1.0.0-plus.tar.gz.
>
> OK - that may be good news, at least I'm not going insane then ;)
>
> Is there a quick patch I can apply, or should I grab & build the source to
> see if this is fixed on the trunk?
>
>
> Romain Manni-Bucau wrote
> >
> > are you using tomee 1.0.0? if yes i think there was a bug about fixed on
> > trunk
> >
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/TomEE-openJPA-logging-not-working-tp4656828p4656831.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: TomEE openJPA logging not working

Posted by twelveeighty <tw...@gmail.com>.
Awesome! That worked.

I used the following in system.properties:
openjpa.Log = log4j

And it did exactly what I expected. Thanks!


Bertrand Guay-Paquet wrote
> 
> Add to system.properties:
> openjpa.Log = DefaultLevel=TRACE, SQL=TRACE, Query=TRACE
> 
> See here for full thread:
> http://openejb.979440.n4.nabble.com/Logging-Levels-of-OpenJPA-in-Apache-TomEE-tp4641573.html
> 




--
View this message in context: http://openejb.979440.n4.nabble.com/TomEE-openJPA-logging-not-working-tp4656828p4656868.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: TomEE openJPA logging not working

Posted by Bertrand Guay-Paquet <be...@step.polymtl.ca>.
Hi,

I had the same issue as you and found this workaround:
Add to system.properties:
openjpa.Log = DefaultLevel=TRACE, SQL=TRACE, Query=TRACE

See here for full thread:
http://openejb.979440.n4.nabble.com/Logging-Levels-of-OpenJPA-in-Apache-TomEE-tp4641573.html

Bertrand


On 12/08/2012 8:29 PM, twelveeighty wrote:
> Yes, I am using apache-tomee-1.0.0-plus.tar.gz.
>
> OK - that may be good news, at least I'm not going insane then ;)
>
> Is there a quick patch I can apply, or should I grab & build the source to
> see if this is fixed on the trunk?
>
>
> Romain Manni-Bucau wrote
>> are you using tomee 1.0.0? if yes i think there was a bug about fixed on
>> trunk
>>
>
>
> --
> View this message in context: http://openejb.979440.n4.nabble.com/TomEE-openJPA-logging-not-working-tp4656828p4656831.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: TomEE openJPA logging not working

Posted by twelveeighty <tw...@gmail.com>.
Yes, I am using apache-tomee-1.0.0-plus.tar.gz.

OK - that may be good news, at least I'm not going insane then ;)

Is there a quick patch I can apply, or should I grab & build the source to
see if this is fixed on the trunk? 


Romain Manni-Bucau wrote
> 
> are you using tomee 1.0.0? if yes i think there was a bug about fixed on
> trunk
> 



--
View this message in context: http://openejb.979440.n4.nabble.com/TomEE-openJPA-logging-not-working-tp4656828p4656831.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: TomEE openJPA logging not working

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

are you using tomee 1.0.0? if yes i think there was a bug about fixed on
trunk

- Romain


2012/8/13 twelveeighty <tw...@gmail.com>

> I am stuck trying to get openJPA to log its openjpa.jdbc.SQL statements. No
> matter what I try, I can't seem to bump up the log level for openJPA.
> Ideally, I'd like to have those logged to my log4j configuration, but at
> this point, I'll settle for ANY solution that will have me see those log
> entries.
>
> My app is an "all in one" WAR, as described in
> http://openejb.apache.org/deploying-in-tomee.html.
>
> Here's what I tried so far:
>
> LOG4J:
> I have a logging.properties file in the <tomee>/lib folder. In it, I use:
> log4j.category.openjpa.jdbc.SQL=DEBUG
>
> This is alongside my other log settings, which are working fine:
> log4j.category.<myroot>=DEBUG, where <myroot> is the root package for my
> own
> code.
>
> For the deployed app, in the META-INF/persistence.xml, I have defined:
> <property name="openjpa.Log" value="log4j"/>
>
> This doesn't work. All I see in the catalina.out console log is the two
> statements:
> INFO - Starting OpenJPA 2.2.0
> INFO - Using dictionary class
> "org.apache.openjpa.jdbc.sql.PostgresDictionary".
>
> But nothing in my log4j log.
>
> JDK LOG:
>
> For this, I added the following to the <tomee>/conf/logging.properties:
> openjpa.jdbc.SQL.level=ALL
>
> And then in my persistence.xml, I use:
> <property name="openjpa.Log" value="commons"/>
>
> This also doesn't work.
>
> I am able to use openJPA logging in log4j with the described method on
> "vanilla" Tomcat 7 with openJPA, so I do not think this is a problem with
> openJPA.
>
> Can someone point me in the right direction? Thanks!
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/TomEE-openJPA-logging-not-working-tp4656828.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>