-->
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.  [ 8 posts ] 
Author Message
 Post subject: Disabling "Hibernate:" logging - more info
PostPosted: Fri Feb 18, 2005 8:44 am 
Newbie

Joined: Fri Jan 14, 2005 4:58 am
Posts: 10
I want to disable all logging using the following log4j.properties file:

### 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.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 cache activity ###
log4j.logger.net.sf.hibernate.cache=off

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

but I still get a lot of logging - see trace excerpt belowe!

For production use I need to disable ALL printouts (for max performance) except critical errors etc - how do I do this?????

Hibernate version:2.1

Mapping documents:NA

Code between sessionFactory.openSession() and session.close():NA

Full stack trace of any exception that occurs:NA

Name and version of the database you are using:MySQL

The generated SQL (show_sql=true):NA

Debug level Hibernate log excerpt:
Hibernate: insert into LogData (time, sequenceNumber, source, recordType, description) values (?, ?, ?, ?, ?)
Hibernate: insert into TracingData (sourceClass, sourceMethod, threadId, id) values (?, ?, ?, ?)
Hibernate: insert into LogData (time, sequenceNumber, source, recordType, description) values (?, ?, ?, ?, ?)
Hibernate: insert into TracingData (sourceClass, sourceMethod, threadId, id) values (?, ?, ?, ?)
Hibernate: insert into LogData (time, sequenceNumber, source, recordType, description) values (?, ?, ?, ?, ?)
Hibernate: insert into TracingData (sourceClass, sourceMethod, threadId, id) values (?, ?, ?, ?)
Hibernate: insert into LogData (time, sequenceNumber, source, recordType, description) values (?, ?, ?, ?, ?)
Hibernate: insert into arguments (id, arg, argument) values (?, ?, ?)
Hibernate: insert into arguments (id, arg, argument) values (?, ?, ?)
Hibernate: insert into arguments (id, arg, argument) values (?, ?, ?)
Hibernate: insert into arguments (id, arg, argument) values (?, ?, ?)
Hibernate: insert into arguments (id, arg, argument) values (?, ?, ?)
Hibernate: insert into arguments (id, arg, argument) values (?, ?, ?)
Hibernate: insert into arguments (id, arg, argument) values (?, ?, ?)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 18, 2005 11:37 am 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
Guess you have
Code:
hibernate.show_sql=true

in your hibernate config.

HTH
Ernst


Top
 Profile  
 
 Post subject: Nope - hibernate.show_sql false
PostPosted: Fri Feb 18, 2005 11:49 am 
Newbie

Joined: Fri Jan 14, 2005 4:58 am
Posts: 10
In my hibernate.proiperties I have:

##############################
### Miscellaneous Settings ###
##############################

## print all generated SQL to the console

hibernate.show_sql false


Top
 Profile  
 
 Post subject: Re: Nope - hibernate.show_sql false
PostPosted: Fri Feb 18, 2005 7:40 pm 
Senior
Senior

Joined: Wed Mar 24, 2004 11:40 am
Posts: 146
Location: Indianapolis, IN, USA
tristpost wrote:
In my hibernate.proiperties I have:

##############################
### Miscellaneous Settings ###
##############################

## print all generated SQL to the console

hibernate.show_sql false


hibernate.show_sql=false

i think you are missing the =


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 28, 2005 1:52 pm 
Newbie

Joined: Sun Dec 26, 2004 1:06 pm
Posts: 7
Location: TX, USA
Quote:
For production use I need to disable ALL printouts (for max performance) except critical errors etc - how do I do this?????


Instead of setting your loggers to "off", set them to "fatal".

_________________
persist. persist. persist.


Top
 Profile  
 
 Post subject: Disabling Hibernate logs in log4j
PostPosted: Thu Jan 25, 2007 11:29 am 
Newbie

Joined: Thu Jan 25, 2007 11:07 am
Posts: 2
<category name="org.hibernate"><priority value="fatal"/></category>

Using the ablove tag in your log4j.xml will solve the problem

OR

Set
org.hibernate = fatal in you log4j.properties file

This will limit your log output.

Hope this info helps!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 12, 2007 7:47 am 
Newbie

Joined: Fri Jan 19, 2007 1:41 pm
Posts: 8
I've got the opposite problem. I don't seem to be able to get any debug logging out of hibernate at all. I have added the following to my log4j.xml

Code:
   <category name="org.hibernate">
     <priority value="ALL" />
   </category>


that did nothing.

I then tried adding a separate appender, which is the recommended approach as far as I can tell:

Code:
   <appender name="HIBERNATE" class="org.jboss.logging.appender.DailyRollingFileAppender">
      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
      <param name="File" value="${jboss.server.log.dir}/hibernate.log"/>
      <param name="Append" value="false"/>

      <param name="DatePattern" value="'.'yyyy-MM-dd"/>

      <layout class="org.apache.log4j.PatternLayout">
         <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
      </layout>
   </appender>


and altering the categories accordingly

Code:
   <category name="org.hibernate">
     <priority value="TRACE" />
     <appender-ref ref="HIBERNATE"/>
   </category>


that didn't work either.

I have tried DEBUG, ALL, TRACE, but all I ever get is the raw SQL which is controlled in the hibernate.cfg.xml. My conclusion is that none of the above is making the slightest bit of difference, so I'm stuck.

I don't have a .properties file in my JBoss instance and as far as I can tell this is a legacy approach and an XML resource file is preferred.

Without being able to switch on debug logging I am really struggling to track issues through my Hibernate code and I've been fiddling with this on and off for two weeks with no success. Very frustrated and would appreciate guidance if you have any.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 12, 2007 7:48 am 
Newbie

Joined: Fri Jan 19, 2007 1:41 pm
Posts: 8
I've got the opposite problem. I don't seem to be able to get any debug logging out of hibernate at all. I have added the following to my log4j.xml

Code:
   <category name="org.hibernate">
     <priority value="ALL" />
   </category>


that did nothing.

I then tried adding a separate appender, which is the recommended approach as far as I can tell:

Code:
   <appender name="HIBERNATE" class="org.jboss.logging.appender.DailyRollingFileAppender">
      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
      <param name="File" value="${jboss.server.log.dir}/hibernate.log"/>
      <param name="Append" value="false"/>

      <param name="DatePattern" value="'.'yyyy-MM-dd"/>

      <layout class="org.apache.log4j.PatternLayout">
         <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
      </layout>
   </appender>


and altering the categories accordingly

Code:
   <category name="org.hibernate">
     <priority value="TRACE" />
     <appender-ref ref="HIBERNATE"/>
   </category>


that didn't work either.

I have tried DEBUG, ALL, TRACE, but all I ever get is the raw SQL which is controlled in the hibernate.cfg.xml. My conclusion is that none of the above is making the slightest bit of difference, so I'm stuck.

I don't have a .properties file in my JBoss instance and as far as I can tell this is a legacy approach and an XML resource file is preferred.

Without being able to switch on debug logging I am really struggling to track issues through my Hibernate code and I've been fiddling with this on and off for two weeks with no success. Very frustrated and would appreciate guidance if you have any.


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