File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Hibernate and java.util.Logging Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate and java.util.Logging" Watch "Hibernate and java.util.Logging" New topic
Author

Hibernate and java.util.Logging

Max Vaha
Greenhorn

Joined: Nov 27, 2007
Posts: 29
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

Joined: Nov 13, 2008
Posts: 84

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

Joined: Nov 27, 2007
Posts: 29
Hello Angel!
I am using 3.3.1 version. How can I plug JUL?
Angel Taveras
Ranch Hand

Joined: Nov 13, 2008
Posts: 84

Just use the JUL wrapper of sl4j. You should only add the sl4j JUL binding and that should do it,

Regards,
Max Vaha
Greenhorn

Joined: Nov 27, 2007
Posts: 29
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

Joined: Nov 13, 2008
Posts: 84

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

Joined: Nov 27, 2007
Posts: 29
Thanks!
I think, if JUL requires .properties in that situation, I'll use log4j instead of it.
 
Don't get me started about those stupid light bulbs.
 
subject: Hibernate and java.util.Logging
 
Similar Threads
how to add dditional properties to DB url in Spring ?
Spring MVC dirt-simple app won't work
DefaultMessageListenerContainer not getting started
DATABASE ERROR: java.sql.SQLException: Invalid argument(s) in call
appContext.xml for transactionManager