-->
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.  [ 3 posts ] 
Author Message
 Post subject: Exception logging
PostPosted: Tue May 02, 2006 1:38 pm 
Regular
Regular

Joined: Tue Jun 08, 2004 8:24 am
Posts: 57
Would it be possible in future releases of Hibernate to remove the automatic exception logging?

Example:
Code:
package org.hibernate;

import org.apache.commons.logging.LogFactory;

public class LazyInitializationException extends HibernateException {

   public LazyInitializationException(String msg) {
      super(msg);
      LogFactory.getLog(LazyInitializationException.class).error(msg, this);
   }

}


I can quite easily catch the exception in my own code and print out a stack trace, or not as my needs may dictate. No need to force it to print and make me put a bunch of logging filters in my log4j settings file.
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 03, 2006 11:20 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
With luck, no. This is a good log. Adding "log4j.logger.org.hibernate=FATAL" to your log4j.properties won't hurt you too much, and it means the rest of us don't have to change our existing log4j.properties files.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 04, 2006 10:43 am 
Regular
Regular

Joined: Tue Jun 08, 2004 8:24 am
Posts: 57
I'm not trying to turn off all Hibernate logs. The error logs are a good thing.

What I don't want is to have error messages spit out for an exception that I'm catching and handling (in this case, a bean copier that uses reflection, and ignores any properties not lazy-loaded by the time the session closes).

If the exception bubbles to the top, it will be reported by either the JVM or your application framework.
Putting an error log message in the constructor of an exception is a bad thing.


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