Hi All,

Rob Hills wrote:
Rob Hills wrote:
Dale Newfield wrote:
Matt Raible wrote:
log4j.properties is AppFuse 1.9.x specific. In 2.0, it's src/main/resources/log4j.xml.
So while it couldn't hurt, apparently it won't help, either.

Not sure why your changes to log4j.xml are not working. Are your changes making into your deployed app in the right place?
Yes, they are. I initially tried editing them within the deployed application (running Tomcat so I'd restart it after making an edit). I can turn SQL logging on and off with the org.hibernate.SQL logger setting, but I can't get parameter values to appear.
This gets weirder. I've tried turning up logging for all of Hibernate via:

<logger name="org.hibernate">
   <level value="DEBUG"/>
</logger>

With this set, the volume of my logging goes up enormously, but I STILL don't get any SQL parameter values.
Finally sorted this out. I'm amazed this isn't better documented and hasn't bitten anyone else before now.

After trying a different google query, I turned up the following discussion:

http://www.javalobby.org/java/forums/t44119.html

In Reply no 4 on this page, there's a mention of the fact that with the latest log4j, you have to specify "TRACE" to turn on parameter value logging, "DEBUG" won't cut it.

So, I turned logging for "org.hibernate" back to "ERROR" in my log4j.xml file (I suspect it will usually be at "ERROR" or "WARN" by default anyway):

<logger name="org.hibernate">
   <level value="ERROR"/>
</logger>

and most importantly, I set "org.hibernate.type" to "TRACE" as follows:
<logger name="org.hibernate.type">
   <level value="TRACE"/>
</logger>

and now I get my SQL parameter values displaying.

Hope this saves someone else a few hours of frustration one day! Is there an FAQ or tutorial on SQL logging on the AppFuse site? If so, I can add this gem to it. Otherwise, I can create one.

Finally, it'd be really nice to be able to turn this on and off via the POM the way you can for hibernate.show_sql. That way, I wouldn't have to remember to manually change it before deploying to production. Anyone know if that's possible? Also, does anyone else think it would be nice if hibernate.show_sql also turned on SQL Parameter logging? If so, I could try entering an issue in the Hibernate Jira.

Rob Hills
Waikiki, Western Australia.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to