Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-2967

Rationalize log-and-throw behavior in CMTTxInterceptor.handleInCallerTx

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • Major
    • 9.0.0.Beta1
    • 8.0.0.Final
    • EJB
    • None

    Description

      CMTTxInterceptor.handleInCallerTx does a log-and-throw:

              setRollbackOnly(tx);
              EjbLogger.ROOT_LOGGER.error(t);
              throw (Exception) t;
      

      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.

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            bstansbe@redhat.com Brian Stansberry
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: