6

When developing or running a spring mvc app locally that uses hibernate, it would be nice if I could get the output of all sql to a separate file.

Is this possible?

I know there is a hibernate property show_sql but I believe that will just get jumbled together with all other log4j logging info, correct?

SethO
  • 2,631
  • 5
  • 27
  • 38
Blankman
  • 248,432
  • 309
  • 736
  • 1,161

1 Answers1

6

Set the org.hibernate.SQL category to DEBUG and use a specific appender for it.

See also

Pascal Thivent
  • 549,808
  • 132
  • 1,049
  • 1,115
  • great, now I need to learn how to use a specific appender. Man java is one config issue to another, will it end!? :) – Blankman Jul 20 '10 at 02:00
  • @Blankman: Never :) Luckily, you'll find some samples in http://stackoverflow.com/questions/436276/configuring-hibernate-logging-using-log4j-xml-config-file and http://stackoverflow.com/questions/2332608/log4j-org-hibernate-type-doesnt-work. – Pascal Thivent Jul 20 '10 at 02:25