简体   繁体   中英

Hibernate log4j not recognizing log4j.properties

I have a hibernate standard java application (not a webapp). Logging already works by default. I would like to see the parameters passed in the sql queries. I have researched that in order to that I need to enable logging. It seems as if hibernate uses slf4j. I have downloaded that jar and its accompanying slf4j-log4j jar. I have added these jars to the classpath. I have also added a log4j.properties to the root of the eclipse project.

I can't seem to have the project recognize that it needs to use slf4j and its properties file.

Do I need to add a reference in my hibernate.cfg.xml?

Make sure you have the property hibernate.show_sql set to true .

format_sql set to true will make the SQL be formatted a bit more pretty.

You may also need to log on TRACE level.

For more details have a look here or here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM