-->
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.  [ 6 posts ] 
Author Message
 Post subject: can't turn logging off
PostPosted: Fri Mar 21, 2008 2:44 pm 
Newbie

Joined: Wed Feb 20, 2008 10:53 am
Posts: 15
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

How do I turn off the tremendous amount of logging Hiberante generates? I can't seem to control it through my log4j config file. Turning show_sql to false doesn't do it either.

Here is some of the logging:

13:18:57,877 DEBUG [QueryPlanCache] unable to locate HQL query plan in cache; generating (select count(s) from SisClient s where s.clientName like '%A%' order by s.clientName)
13:18:57,877 DEBUG [QueryTranslatorImpl] compiling query
13:18:57,892 DEBUG [HQLQueryPlan] HQL param location recognition took 0 mills (select count(s) from SisClient s where s.clientName like '%A%' order by s.clientName)
13:18:57,892 DEBUG [QueryPlanCache] located HQL query plan in cache (select count(s) from SisClient s where s.clientName like '%A%' order by s.clientName)
13:18:57,892 DEBUG [HQLQueryPlan] find: select count(s) from SisClient s where s.clientName like '%A%' order by s.clientName
13:18:57,892 DEBUG [QueryParameters] named parameters: {}


Hibernate version: 3.2

Mapping documents:

hibernate.cfg.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0 //EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="connection.datasource">hibernate/OracleDS</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="show_sql">false</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
<mapping resource="com/enetrix/sis/persist/beans/sisClient.hbm.xml"/>
</session-factory>

</hibernate-configuration>



My log4j config (called A3-log4j.xml):

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">

<appender name="FILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="c:\log\A3.log"/>
<param name="Append" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd MMM yyyy HH:mm:ss} - [%C.%M] - %p - %m%n"/>
</layout>
</appender>

<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.err"/>
<param name="Threshold" value="INFO"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
</layout>
</appender>

<category name="business">
<priority value="INFO"/>
<appender-ref ref="FILE"/>
<appender-ref ref="CONSOLE"/>
</category>

<root>
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>

</log4j:configuration>


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 22, 2008 12:01 am 
Newbie

Joined: Wed Mar 19, 2008 10:46 pm
Posts: 5
Have you tried to put log4j.properties in the classpath?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 22, 2008 3:51 am 
Expert
Expert

Joined: Thu Jul 05, 2007 9:38 am
Posts: 287
how does log4j know to use A3-log4j.xml?
Me guess is it doesn't.

_________________
Please rate useful posts.


Schauderhaft: Softwaredevelopment, Projectmanagement, Qualitymanagement and all things "schauderhaft"


Top
 Profile  
 
 Post subject: turn off logging
PostPosted: Sun Mar 23, 2008 6:00 pm 
Newbie

Joined: Wed Feb 20, 2008 10:53 am
Posts: 15
So if I don't have something called log4j.properties, what is Hibernate using to do all this logging?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 23, 2008 6:34 pm 
Beginner
Beginner

Joined: Wed Mar 21, 2007 10:23 am
Posts: 20
Dear badgerduke,

If you don't have log4j.properties, log4j will use its default configuration.

To be able to control the logging activity of log4j, you need to have either log4j.xml or log4j.properties in your classpath. You also can specify a location for your properties file but I guess it is not your case.

Furthermore, I see you specified the level INFO for your console appender. If you want to completely shut down hibernate logging, you have to set the threshold of your logger or your appender to FATAL or ERROR.


I hope this help.


Top
 Profile  
 
 Post subject: THANK YOU
PostPosted: Mon Mar 24, 2008 11:50 am 
Newbie

Joined: Wed Feb 20, 2008 10:53 am
Posts: 15
Yes that helped. Thank you!


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