0
votes

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?

1
AFAIK i dont think you need to mention reference in hibernate.cfg or web.xml. I ran a Spring-mvc hibernate app and used slf4j for logging version 1.4.2. Just try changing the version which might help. Do you want to see something like this?[Hibernate: select contact0_.account as account0_, contact0_.cycle_date as cycle2_0_, contact0_.letter_code as letter3_0_, contact0_.status as status0_ from "Accounts" contact0_]viswanath patimalla

1 Answers

0
votes

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.