-->
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.  [ 4 posts ] 
Author Message
 Post subject: Enabling hibernate log4j
PostPosted: Fri May 25, 2007 4:27 pm 
Beginner
Beginner

Joined: Fri May 11, 2007 11:03 am
Posts: 32
Hi Everybody,
I am working on struts and hibernate project. I am using commons logging for struts which is working fine.
I am trying to enable logging for hibernate but my attempts have given any fruit. I heard that commons logging can wrap log4j, so I was trying to enable log4j for hibernate.
Can anybody help me in doing that?
Thanks


Top
 Profile  
 
 Post subject: log4j
PostPosted: Fri May 25, 2007 5:26 pm 
Newbie

Joined: Fri May 25, 2007 2:09 pm
Posts: 6
Here's an example log4j.properties that we use. The last DEBUG setting generates quite a bit of logs.

log4j.rootLogger=INFO, logfile

log4j.appender.logfile=org.apache.log4j.RollingFileAppender
log4j.appender.logfile.File=./logs/hibernate.log
log4j.appender.logfile.MaxFileSize=100MB
# Keep three backup files.
log4j.appender.logfile.MaxBackupIndex=5
# Pattern to output: date priority [category] - message
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n

log4j.logger.org.hibernate.SQL=DEBUG
log4j.logger.org.hibernate=DEBUG


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 30, 2007 7:04 pm 
Beginner
Beginner

Joined: Fri May 11, 2007 11:03 am
Posts: 32
Hi mlai,
I tried doing that but it seems it doesnt even go into this properties file.
Can you tell me what all to do before this. How would the application see this properites file.
Coz right now my struts logger is working fine and its using simplelogging whereas for hibernate i need log4 logging.
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 30, 2007 7:32 pm 
Newbie

Joined: Fri May 25, 2007 2:09 pm
Posts: 6
Put the log4j.properties in the application's classpath.

Check out this short tutorial: http://www.laliluna.de/log4j-tutorial.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.