How do you enable debug logging for OpenJPA when running an application in WebLogic 11g? I tried the steps given by http://stackoverflow.com/questions/792741/logging-jpa-sql-with-weblogic-10-3, but no OpenJPA log statements appear in the server log. I have also poured over the WebLogic documentation regarding the configuration of logging, but am unclear as to how to enable debug logging for this particular subsystem (JPA). Any ideas?
Did you try to enable verbose logging using the following property in your persistence.xml
file:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0">
<persistence-unit name="example-logging" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="openjpa.Log" value="SQL=TRACE"/>
</properties>
</persistence-unit>
</persistence>
BAH! I just fixed this problem, and its cause is quite frustrating!
When I configured Logging for my server via the WebLogic console ([my domain] -> Environment -> Servers -> [my server] -> Logging tab), I set "Minimum severity to log" at "Trace" and "Severity level" for the server log file to "Debug" (both are options under "Advanced"). Notably, the "Severity level" select box did not provide a "Trace" option. Thus, when I saved the configuration, the server log level was set to Debug. I have since learned that most of Kodo's (and OpenJPA's?) logging is at the Trace level, which is why I couldn't see any JPA logging, even after enabling debug for the JPA subsystem via the "Debug" tab.
The description next to the "Severity level" select box says that "By default all messages go to the log file," so if I hadn't tried to configure logging, I wouldn't have encountered this issue. In order to see Kodo trace logging in the server log, I had to open up my config.xml file (user_projects\domains[my domain]\config\config.xml) and remove the element under .
Consequently, I am baffled as to why the WebLogic console doesn't provide "Trace" as an option for the "Severity level" select boxes under the "Advanced" section of the Logging tab. Is this an oversight, or am I missing a good reason for the omission?