Java – displays JPA SQL statements when using play framework 2

I am developing a web application using play framework and JPA / hibernate For debugging purposes, I'm glad to see the SQL statements used by JPA Another thread already has the same problem, but it's about play 1, and the given solution doesn't work for me - it seems JPA Debugsql = true cannot be used in play 2 (the no persistence provider name of entitymanager is true)

Instead, I'm in play's application The following has been added to conf:

db.default.logStatements=true
logger.org.hibernate=DEBUG

I'm not sure if I need two lines, but at least the SQL statement is recorded now However, for large queries, hibernate prints a large number of debugging messages, making the printed SQL statements disappear in my console window I've tried to increase the buffer of the console window, but this hasn't changed much

What should I do to check the statement in a comfortable way?

Edit:

Set logger org. When hibernate is set to info, I don't get any statements at all (even if db.default.logstatements = true)

Solution

Try configuration first

db.default.logStatements=true
logger.org.hibernate=DEBUG

Find out which class records statements (for example, org. Hibernate. XXX. Statementlogger) Change back to org Hibernate info and add a new line to the statement logger package:

logger.org.hibernate=INFO
logger.org.hibernate.xxx=DEBUG
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>