-->
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.  [ 5 posts ] 
Author Message
 Post subject: disable logs in hibernate
PostPosted: Mon Nov 21, 2005 5:48 am 
Newbie

Joined: Tue Oct 04, 2005 1:35 am
Posts: 12
Hibernate version: - 3.0

Name and version of the database you are using: MySql 4.0.24

The generated SQL (show_sql=true): - false


Hi all ,

I want to disable the warnings shown bu hibernate on my console.. can anybody tell me how to da that?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 6:55 am 
Beginner
Beginner

Joined: Mon Jan 24, 2005 11:56 am
Posts: 24
Hi,

As you know hibernate uses log4j for its loging mechanism.

put a log4j.properties in your class path and config it some thing like below:

Code:
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger= ERROR, A1

# Now deal with hibernate packages to narrow packeges by changinf #below to FATAL, ERROR, INFO, WARN, DEBUG
log4j.org.hibernate=INFO, A1
log4j.org.hibernate.tool.ant=ERROR, A1
log4j.org.hibernate.jdbc=ERROR, A1
log4j.org.hibernate.collection=ERRORm A1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n



Regards,
Alireza Fattahi
--------------------------
Please rate if it helped!


Top
 Profile  
 
 Post subject: Re:disable logs in hibernate
PostPosted: Mon Nov 21, 2005 7:21 am 
Newbie

Joined: Tue Oct 04, 2005 1:35 am
Posts: 12
Thanx for ur response..
I did the same as u told.. but it seems that this property file is not getting picked up. i put it into the classpath.
do we need any setting in web.xml or hibernate.cfg.xml to mention the location of log4j.properties ??


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 12:06 pm 
Newbie

Joined: Wed Jul 13, 2005 7:00 pm
Posts: 9
Venki,

Hibernate uses commons-logging which in turn uses log4j if log4j.jar is present in the classpath. So, check if log4j.jar is present in your classpath.

log4j.properties need not be configured either in hibernate.cfg.xml or in hibernate.properties. Create a log4j.properties as given by afattahi and put it in WEB-INF/classes.

This should solve the problem.

Are you getting a message saying that the log4j is configured properly. If you get this in your console, then log4j is present but its not able to find the log4j.properties.

If you give the specific webcontainer/appserver that you are using, people who used the same server might help you with the configuration (class-loading etc).

Hope this helps.


Top
 Profile  
 
 Post subject: Re:disable logs in hibernate
PostPosted: Tue Nov 22, 2005 12:23 am 
Newbie

Joined: Tue Oct 04, 2005 1:35 am
Posts: 12
Thank u very much rmutyala,

i did as u told.. and its now working.. log4j.jar was present but it didn't locate the log4j.properties..

thanx again


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