[jboss-jira] [JBoss JIRA] (WFLY-2967) Rationalize log-and-throw behavior in CMTTxInterceptor.handleInCallerTx

Scott Marlow (JIRA) issues at jboss.org
Wed Feb 19 12:21:47 EST 2014


    [ https://issues.jboss.org/browse/WFLY-2967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12946086#comment-12946086 ] 

Scott Marlow commented on WFLY-2967:
------------------------------------

Also, when something calls tx.setRollbackOnly(), the first question is usually why did that happen, so it can be addressed.  Having the exception logged in the server side log, is more convenient as that is closest to the problem origin.  

It may also be that the client side is remote and not accessible to the server side developer.  
                
> Rationalize log-and-throw behavior in CMTTxInterceptor.handleInCallerTx
> -----------------------------------------------------------------------
>
>                 Key: WFLY-2967
>                 URL: https://issues.jboss.org/browse/WFLY-2967
>             Project: WildFly
>          Issue Type: Task
>      Security Level: Public(Everyone can see) 
>          Components: EJB
>    Affects Versions: 8.0.0.Final
>            Reporter: Brian Stansberry
>            Assignee: David Lloyd
>
> CMTTxInterceptor.handleInCallerTx does a log-and-throw:
> {code}
>         setRollbackOnly(tx);
>         EjbLogger.ROOT_LOGGER.error(t);
>         throw (Exception) t;
> {code}
> Generally this is an anti-pattern, although there may be utility in logging some events server-side as an aid in diagnostics or something. IMO if the exception indicates some sort of server fault, as opposed to a client or application state mistake, it needs to be logged server-side. But I'm not sure where the dividing line is.
> It doesn't look like this particular example is nicely playing such a role though.
> 1) It's only called in MANDATORY/REQUIRED/SUPPORTS scenarios where a tx already exists. So, what it logs is logged in some scenarios and not in others.
> 2) It logs stuff that looks pretty clearly like client mistakes, in particular NoSuchEJBException and NoSuchEntityException. I don't believe these add value to the server log, at least not at a level above DEBUG.
>  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list