-->
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.  [ 13 posts ] 
Author Message
 Post subject: how to turn off logging
PostPosted: Sun Apr 30, 2006 3:51 pm 
Beginner
Beginner

Joined: Mon Feb 13, 2006 8:34 pm
Posts: 27
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0

Is this possible to turn off logging somehow? When I make some batch inserts I don't need all those informations on my console :-)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 30, 2006 8:23 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Change/Setup the log4j settings approrpiately.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 30, 2006 9:35 pm 
Regular
Regular

Joined: Wed Jul 27, 2005 2:33 am
Posts: 118
Have a look at:

http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#configuration-logging

Log4j:

http://logging.apache.org/log4j/docs/manual.html


Top
 Profile  
 
 Post subject: <property name="show_sql"> false </proper
PostPosted: Mon May 01, 2006 8:49 am 
Newbie

Joined: Wed Apr 26, 2006 6:29 am
Posts: 4
Location: India
add the property in hibernate.cfg.xml file
<property name="show_sql"> false </property>
if u set this property u wont get any sql statements in your log

-----------------------------------
dont forget to rate


Top
 Profile  
 
 Post subject: Log
PostPosted: Mon May 01, 2006 9:00 am 
Beginner
Beginner

Joined: Mon Feb 13, 2006 8:34 pm
Posts: 27
I put log4j.jar to project's jars. I also put log4j.properties file to classpath.

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{ABSOLUTE} %5p %c{1}:%L - %m%n
   
 
### set log levels - for more verbose logging change 'info' to 'debug' ###

log4j.rootLogger=off
   
log4j.logger.net.sf.hibernate=off
   
### log just the SQL
log4j.logger.net.sf.hibernate.SQL=off
   
### log JDBC bind parameters ###
log4j.logger.net.sf.hibernate.type=off
   
### log schema export/update ###
log4j.logger.net.sf.hibernate.tool.hbm2ddl=off
   
#Log all second-level cache activity
log4j.logger.net.sf.hibernate.cache=off

#Log all JDBC resource acquisition
log4j.logger.net.sf.hibernate.jdbc=off   

#Log transaction related activity
log4j.logger.net.sf.hibernate.transaction=off   

#Log HQL and SQL ASTs during query parsing
log4j.logger.net.sf.hibernate.hql.ast.AST=off   

#Log the state of all entities (max 20 entities) associated with the session at flush time
log4j.logger.net.sf.hibernate.pretty=off   

#Log all JAAS authorization requests
log4j.logger.net.sf.hibernate.secure=off



but I still have log information for every single insert I made.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 01, 2006 9:46 am 
Regular
Regular

Joined: Wed Jul 27, 2005 2:33 am
Posts: 118
In the log4j.properties that you are using, i see that you have stated net.sf.hibernate as the package. In your first post you mentioned that you are using Hibernate3.0. In Hibernate 3, the package structure is no longer net.sf.hibernate. It is org.hibernate. So you will have to do changes to the log4j.properties appropriately.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 01, 2006 9:49 am 
Regular
Regular

Joined: Wed Jul 27, 2005 2:33 am
Posts: 118
I would say adding just the following statement(for setting log level, apart from the additional appender related details) in your log4j.properties file should help:

Code:
log4j.logger.org.hibernate=off


Try it out


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 03, 2006 6:08 pm 
Beginner
Beginner

Joined: Mon Feb 13, 2006 8:34 pm
Posts: 27
I switched net.sf.hibernate to org.hibernate, I also added log4j.logger.org.hibernate=off but I still receive log informations? Really need help with this:-)
thx...


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 03, 2006 6:32 pm 
Beginner
Beginner

Joined: Mon Feb 13, 2006 8:34 pm
Posts: 27
Sth has changed because I do not have all those informations at the biginning:

Code:
2006-05-04 00:21:37 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.0
2006-05-04 00:21:37 org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
2006-05-04 00:21:37 org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
2006-05-04 00:21:37 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
2006-05-04 00:21:37 org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
...


but I still have log informations about operations I do, about every insert, update etc.
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 03, 2006 7:20 pm 
Regular
Regular

Joined: Wed Jul 27, 2005 2:33 am
Posts: 118
Post the log that you are seeing and would want to get rid off.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 03, 2006 7:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Here is a sample. Use # to comment out the logging (as shown) - also change what might just be interesting to you in terms of a error messages to error. Also check you connection config for 'show sql' etc settings.
See below:

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{ABSOLUTE} %5p %c{1}:%L - %m%n

### direct messages to file hibernate.log ###
#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

### set log levels - for more verbose logging change 'info' to 'debug' ###

log4j.rootLogger=warn, stdout

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

### log just the SQL
#log4j.logger.org.hibernate.SQL=debug

### log JDBC bind parameters ###
#log4j.logger.org.hibernate.type=debug

### log schema export/update ###
#log4j.logger.org.hibernate.tool.hbm2ddl=debug

### log HQL parse trees
#log4j.logger.org.hibernate.hql=debug

### log cache activity ###
#log4j.logger.org.hibernate.cache=debug

### log JDBC resource acquisition
#log4j.logger.org.hibernate.jdbc=debug

### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 04, 2006 5:00 am 
Beginner
Beginner

Joined: Mon Feb 13, 2006 8:34 pm
Posts: 27
I have set all as You showed me but I still hava these messages:
Code:
Hibernate: insert into Osoba_ct (data_urodzenia, imie, nazwisko) values (?, ?, ?)
....


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 04, 2006 8:44 am 
Beginner
Beginner

Joined: Sun Feb 19, 2006 3:50 am
Posts: 34
As a previous poster mentioned, you need to set your show_sql property to false in your hibernate properties file. The messages you're now trying to get rid of are not log4j messages, and they're controlled with the show_sql property of your hibernate properties file. Set show_sql to false and they should go away.


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