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

David Beaton (JIRA) noreply at atlassian.com
Tue Jun 14 13:47:25 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42590#action_42590 ] 

David Beaton commented on HHH-3361:
-----------------------------------

I have wasted a lot of time because of this for the same reason as Benoit - I thought this exception wasn't being caught when it actually was.  I also don't want to supress as I want to know about unhandled LIEs.  Removing one line of code should allow this to be closed off.

> LazyInitializationException generate an error message in the logs
> -----------------------------------------------------------------
>
>                 Key: HHH-3361
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3361
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.0.CR1
>            Reporter: benoit heinrich
>            Priority: Minor
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> 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