-->
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.  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Turn off logging from log4j and slf4j
PostPosted: Thu Sep 25, 2008 6:45 am 
Newbie

Joined: Wed Jul 02, 2008 5:42 am
Posts: 6
Hi there,

i just updated my hibernate core to the new version and have really big trouble with the slf4j thing.

since i update the hibernate core and download the slf4j 1.5.2 library from their site, i get thousands of logging messages like:

Code:
0 [main] INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.4.0.GA
15 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.1.GA
31 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found


i try to add a log4j.properties file and add this line:
Code:
log4j.rootCategory=WARN, dev

log4j.appender.dev=org.apache.log4j.ConsoleAppender
log4j.appender.dev.layout=org.apache.log4j.PatternLayout
log4j.appender.dev.layout.ConversionPattern=%5p - %m%n


But nothing changed...

Hope somebody can tell me how i can turn off all these info Messages cause it really annoys me a lot!

Thanks a lot and greetings from Germany!
Daniel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 7:55 am 
Beginner
Beginner

Joined: Thu Jun 14, 2007 4:33 am
Posts: 39
change the log-level of hibernate to ERROR or FATAL (or whatever you like):

Code:
log4j.logger.org.hibernate = ERROR, stdout


i wouldnt suggest to completely turn of logging


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 8:46 am 
Newbie

Joined: Wed Jul 02, 2008 5:42 am
Posts: 6
soulspirit wrote:
change the log-level of hibernate to ERROR or FATAL (or whatever you like):

Code:
log4j.logger.org.hibernate = ERROR, stdout



I added this line, but nothing changed :-(


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 8:51 am 
Beginner
Beginner

Joined: Thu Jun 14, 2007 4:33 am
Posts: 39
here is a config-file of mine:
Code:
# Configure Root Logger
log4j.rootLogger = DEBUG, stdout
log4j.logger.org.hibernate = ERROR, stdout
log4j.logger.org.springframework = ERROR, stdout

# Configure stdout Appender
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern = %d [%t] %-5p %c - %m%n


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 9:00 am 
Newbie

Joined: Wed Jul 02, 2008 5:42 am
Posts: 6
Hi soulspirit,

i try to run it exactly with your config-file but the hibernate logging is still there .-(

Did i have to set anything else in my Code?
I try to do this, to get certain that he use the right file before anything else is calling:
Code:
PropertyConfigurator.configureAndWatch( "log4j.properties", 60*1000 );


but logging is still there ...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 9:16 am 
Beginner
Beginner

Joined: Thu Jun 14, 2007 4:33 am
Posts: 39
no i just have the log4j.properties in my output dir. make sure its copied there when building your application.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 9:30 am 
Newbie

Joined: Wed Jul 02, 2008 5:42 am
Posts: 6
hmm ok i see that he found the properties file but it is really weird ...

i do a little test like this:

Code:
private static Logger logger = org.apache.log4j.Logger.getLogger("org.hibernate");

public static void main(String[] args)
    {
       logger.info("TEST MESSAGE!!!!");
    }


i can't see the test Message output cause it hat the INFO level. When i chage the code to:
Code:
logger.fatal("TEST MESSAGE!!!!");


i can see the output so the properties file seems to work.
But i still see the whole other output stuff ...
(maybe it is important that the annoying stuff is in red?!)

Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 1:49 pm 
Newbie

Joined: Wed Sep 24, 2008 8:12 pm
Posts: 3
How did you turn it on. I cant get that to turn on. I have slf4j-api-1.5.3.jar, slf4j-log4j12-1.5.3.jar in the class path and I have:

Code:
<logger name="org.hibernate">
          <level value="debug"/>
          <appender-ref ref="hb.rolling.file"/>
          <appender-ref ref="dre.console"/>
    </logger>
   


in my log4j.xml. I am using dom configurator.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 26, 2008 2:43 am 
Newbie

Joined: Wed Jul 02, 2008 5:42 am
Posts: 6
peterpan wrote:
How did you turn it on. I cant get that to turn on. I have slf4j-api-1.5.3.jar, slf4j-log4j12-1.5.3.jar in the class path ...


I can't run my application with only these 2 classes cause i need the "slf4j-simple-1.5.2.jar" from the slf4j project site to start the app.

I didn't turn on anything, i get these output after upgrading to new hibernate and inclusing this slf4j library :-(

Anybody who can helps me to put that stuff off? Thanks a lot!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2008 1:57 am 
Newbie

Joined: Wed Dec 17, 2008 1:45 am
Posts: 5
Has anyone figured this out???? I am also having this issue. I have a log4j.properties file in my classpath and changing it alters log output from other parts of my application, but hibernate logs are unaffected. I also noticed that the format of the log statements are not the same as what log4j is using.

Is it possible that hibernate is trying to use some other logging here?

I also have log4j & slf4j in my classpath, but am only using log4j. However if I remove slf4j from the project, I get errors from hibernate that is trying to use slf4j.

This happens even if I set org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger to tell it to use log4j.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2008 2:17 am 
Newbie

Joined: Wed Dec 17, 2008 1:45 am
Posts: 5
Ok, I found a solution. I had the slf4j common and log4j jars in the classpath. I removed the common one and it works correctly now.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2009 5:17 pm 
Newbie

Joined: Mon Oct 23, 2006 2:26 pm
Posts: 2
Hello,

I dont have the common jar file that you said taking out would fix. I have the following in the same order.

antlr-2.7.6.jar
commons-collections-3.1.jar
dom4j-1.6.1.jar
javassist-3.4.GA.jar
jta-1.1.jar
hibernate3.jar
slf4j-jdk14-1.5.2.jar
log4j-1.2.15.jar
classes12.jar
slf4j-api-1.5.2.jar

Do you see any version descrepencies?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 20, 2009 2:25 pm 
Newbie

Joined: Tue Jan 20, 2009 2:17 pm
Posts: 1
svsvenu wrote:
Hello,

I dont have the common jar file that you said taking out would fix. I have the following in the same order.

antlr-2.7.6.jar
commons-collections-3.1.jar
dom4j-1.6.1.jar
javassist-3.4.GA.jar
jta-1.1.jar
hibernate3.jar
slf4j-jdk14-1.5.2.jar
log4j-1.2.15.jar
classes12.jar
slf4j-api-1.5.2.jar

Do you see any version descrepencies?

Thanks


I think you don't need slf4j-jdk14-1.5.2.jar. Instead, you should use slf4j-log4j12-1.5.2.jar if you are going to use log4j library (at least, you have the log4j jar).

Remember to use the same version for slf4j-api and slf4j-log4j, just in case...

If you remove slf4j-jdk14-1.5.2.jar and add slf4j-log4j12-1.5.2.jar you should be able to manage logging from the log4j.properties file.

I hope this helps.


Top
 Profile  
 
 Post subject: Re: Turn off logging from log4j and slf4j
PostPosted: Mon Aug 24, 2009 11:40 am 
Newbie

Joined: Mon Aug 24, 2009 11:34 am
Posts: 2
Have ever figure out how to disable hibernate logging
I think I have the same issue?
I can control logging coming from my custom files by configuring log4j.xml placed in the root of my classpath.
Hibernate does not respond to any configuration changes in that file.
Please, help me to deal with this.


Top
 Profile  
 
 Post subject: Re: Turn off logging from log4j and slf4j
PostPosted: Fri Jun 11, 2010 4:09 pm 
Newbie

Joined: Fri Jun 11, 2010 3:52 pm
Posts: 4
Luis_hibernate has it right..

SLF4J is used by hibernate and if you are using log4j you need to setup the bridge for your logging system.
http://www.slf4j.org/legacy.html

you will need the slf4j-api, but make sure you also have slf4j-log4j12-1.x.x.jar

Remember you can only have one bridge at a time so you may have to delete or exclude (for maven users) any other slf4j loggers (such as slf4jsimple)

hope this helps


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 19 posts ]  Go to page 1, 2  Next

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.