Andrei,
If you haven't solved this issue, the simplest way I've found to enable
OpenJPA logging within Tomcat is to:

1) add this property to your persistence.xml

<property name="openjpa.Log" value="commons"/>

2) create a logging.properties file with the following content and add it to
the WEB-INF/classes directory of your war.

handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

org.apache.juli.FileHandler.level = ALL
org.apache.juli.FileHandler.directory = ${catalina.base}/logs
org.apache.juli.FileHandler.prefix = openjpa.

java.util.logging.ConsoleHandler.level = ALL
java.util.logging.ConsoleHandler.formatter =
java.util.logging.SimpleFormatter

# enable SQL logging
openjpa.jdbc.SQL.level=ALL

OpenJPA should log to a file with a name prefixed with "openjpa" in the
tomcat logs directory.  The *.ConsoleHandler.* properties enable logging to
the console so you may/may not want to include those.

hth,
-Jeremy

On Tue, Dec 30, 2008 at 9:50 PM, Andrei Tchijov <[email protected]> wrote:

>
> Sorry if this topic was discussed before (and will be very glad just to get
> pointer to previous discussion).
> I am having difficulties with controlling opnejpa logging when it is
> running
> "inside" tomcat (6.0).  So far I have tried following:
> - specifying openjpa.Log property in persistence.xml file,
> - passing openjpa.Log property(among others) to
> createEntityManagerFactory(),
> - adding "openjpa. ... .level=..." lines to conf/logging.properties file
> What I want is to be able to see SQL statements (and I can see them when I
> run my code outside of tomcat), what I got is two messages:
>  ...  openjpa.Runtime - Starting OpenJPA 1.2.0
>  ...  openjpa.jdbc.JDBC - Using dictionary class
> "org.apache.openjpa.jdbc.sql.MySQLDictionary".
> Your advice will be highly appreciated,
>
> Andrei Tchijov
> --
> View this message in context:
> http://n2.nabble.com/How-to-configure-openjpa-logs-from-%22inside%22-tomcat-%286.0%29--tp2094916p2094916.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>

Reply via email to