[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3361) LazyInitializationException generate an error message in the logs

benoit heinrich (JIRA) noreply at atlassian.com
Fri Jun 27 06:10:18 EDT 2008


LazyInitializationException generate an error message in the logs
-----------------------------------------------------------------

                 Key: HHH-3361
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3361
             Project: Hibernate3
          Issue Type: Bug
          Components: core
    Affects Versions: 3.3.0.CR1
            Reporter: benoit heinrich
            Priority: Minor


Hi,

When a LazyInitializationException is thrown a log message is automatically created by the exception class because of the line 19 in the LIE class:

 LoggerFactory.getLogger( LazyInitializationException.class ).error( msg, this );


An exception should not write log messages, this is part of the application that handle the exception that should decide either or nor a log message should be created.
The exception should just carry all information with it and no more.

Actually this is causing a serious problem to one of the application I'm working on because LIE is a normal exception and is caught and handled correctly and each time a LIE is thrown by hibernate I'm getting a full stack trace in the logs (which is wrong in my case because the exception is handled correctly).

Also I don't want to change the log4j settings to ignore the LIE because I'd like to know when I get a LIE that is not caught.

So my suggestion is to simply remove the Log entry from the LIE constructor since normally this message is anyway redundant because if the exception is not caught the application will dump the exception in most of the time.


Cheers,
/Benoit

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list