Every development needs a debugging.
Sometimes it's quite hard to figure out what's the problem in our Hibernate-powered JPQL queries with default logging setup.
If we need to see some meaningful data instead of annoying "?" signs in the logs, just use the following quick approach for the local Tomcat/TomEE installation:
First of all, make sure, the SQL-logging is enabled in your META-INF/persistence.xml:
In the LIB directory of your local TomEE, e.g. C:\Java\apache-tomee-webprofile-1.6.0.2\lib place 2 following files:
- log4j-1.2.14.jar, and
- log4j.xml
Below is the sample log4j.xml contents:
Restart your java web container.
In the current configuration the new log file will be created in C:\Java\apache-tomee-webprofile-1.6.0.2\bin\ hibernate_log4j.log
The sample logger output could look like this:
eof