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: Hibernate console output
PostPosted: Tue Jan 02, 2007 9:44 pm 
Newbie

Joined: Tue Jan 02, 2007 9:14 pm
Posts: 2
Hello

I'm creating a desktop application with hibernate. Everything goes great except of logging. I configured log4j and use simplest log4j.properties file:

Code:
### direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %5p %c{1}:%m%n
### set log levels - for more verbose logging change
### 'info' to 'debug'
log4j.rootLogger=fatal, stdout
log4j.logger.org.hibernate=fatal


According to documentation this should make log4j to show only fatal messages ("lowest console noise"), bu everytime my application do something I see messages like this:
Code:
[java] Hibernate: select device0_.deviceId as deviceId2_, device0_.version as version2_, device0_.name as name2_, device0_.description as descript4_2_ from Device device0_ order by device0_.name
...
[java] Hibernate: insert into PictureSection (pictureSectionId, version, numberOf, sourceSectionId, pictureId) values (null, ?, ?, ?, ?)
[java] Hibernate: call identity()

which are regular processing messages (not fatal). I'm posting this to hibernate forum (not log4j forum) because after I switched to native java logging (by deleting jar and properties files). I still see those messages.
I don't want to application user to see those messages (each time when hibernate do something with database) and It slows down processing.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 03, 2007 3:48 am 
Regular
Regular

Joined: Thu Aug 17, 2006 4:50 am
Posts: 55
Location: Mallorca
can you check that your log4j.properties is in the classpath?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 03, 2007 5:25 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Since I can see only see SQL in the console, I guess that it's not log4j here, but the show_sql property in your hibernate.cfg.xml file that is certainly set true.

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject: Hibernate console output - solved
PostPosted: Thu Jan 04, 2007 1:36 am 
Newbie

Joined: Tue Jan 02, 2007 9:14 pm
Posts: 2
Yes Dominicus the log4j.properties was in the classpath. Batmat was right. Documentation says that this flag make hibernate to: "Write all SQL statements to console". Unfortunately I thought that if hibernate uses log4j every messages go through log4j instead of straight to the console. It is a little bit confusing don't you think? Any way problem is solved. Thank You very much for quick answer.


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.