-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Redirecting hibernate logging
PostPosted: Mon Feb 04, 2008 10:26 pm 
Newbie

Joined: Thu Jan 17, 2008 4:55 pm
Posts: 3
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.2

Is it possible to get Hibernate to log into a separate file using the log4j.category entry in log4j.properties. I tried the following in my log4j.properties file and did not work.

......
......

log4j.appender.cm_hibernate_file=org.apache.log4j.FileAppender
log4j.appender.cm_hibernate_file.File=cm.hibernate.log
log4j.appender.cm_hibernate_file.layout=org.apache.log4j.PatternLayout
log4j.appender.cm_hibernate_file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n


#log4j.logger.org.hibernate=info
log4j.logger.org.hibernate=debug

log4j.category.org.hibernate=DEBUG,cm_hibernate_file
log4j.additivity.org.hibernate=false

...........
...........


Thanks for any help


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 05, 2008 10:18 am 
Newbie

Joined: Mon Jun 11, 2007 1:34 pm
Posts: 11
Take a look at this:
http://ideoplex.com/id/386/controlling-hibernate-output-with-log4j

Basically, you have to put these lines in your log4j.properties

Code:
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=hibernate.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

log4j.rootLogger=warn, file


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 05, 2008 2:07 pm 
Newbie

Joined: Thu Jan 17, 2008 4:55 pm
Posts: 3
If i put


log4j.rootLogger=warn, file


in the log4j file then all the log goes into that file, I need the Hibernate log alone to go into the hibernate.log file. Here is what i am trying to achieve...


1. All logs except hibernate and my class files go to rootLogger
2. Hibernate logs go to Hibernate.log file
3. My class file logs go to myfile.log


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.