Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate and java.util.Logging

 
Max Vaha
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, ranchers!
I want to turn on sql logging using

How can I use a logger from JUL instead of log4j in that situation?
Thanks in advance.
 
Angel Taveras
Ranch Hand
Posts: 84
Eclipse IDE Hibernate Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello which version of hibernate are you using? i understand that the latest version uses sl4j that it's an API to made the logging pluggable and make hibernate to able to JUL or any other logging framework.
[ December 10, 2008: Message edited by: Angel Taveras ]
 
Max Vaha
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Angel!
I am using 3.3.1 version. How can I plug JUL?
 
Angel Taveras
Ranch Hand
Posts: 84
Eclipse IDE Hibernate Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just use the JUL wrapper of sl4j. You should only add the sl4j JUL binding and that should do it,

Regards,
 
Max Vaha
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, I didn't found good examples about sl4j.

If I have a method:

How can I log generated sql query to the file "sql.log"?
 
Angel Taveras
Ranch Hand
Posts: 84
Eclipse IDE Hibernate Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you have to configure the logger using a property file (loggging.properties) preferably. You could configure a hibernate package to send it to the file sql.txt as you suggested. If you need more info to configure the JUL logger via a property file you can find it here,

i hope this helps,

Regards,
 
Max Vaha
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
I think, if JUL requires .properties in that situation, I'll use log4j instead of it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic