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,703
  • 5
  • 28
  • 38
Blankman
  • 259,732
  • 324
  • 769
  • 1,199

1 Answers1

6

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

See also

Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
  • 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