Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-3021

Logger.throwing(Throwable) does not document level it is logging at

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.14.0
    • Fix Version/s: 3.0.0, 2.14.1
    • Component/s: Documentation
    • Labels:
      None

      Description

      The documentation of the method Logger.throwing(Throwable) is not mentioning at which level it is logging at.
      It appears AbstractLogger is logging at level ERROR, but without it being explicitly mentioned, I think expecting it to be logged at DEBUG might also be a reasonable expectation.

      In fact LOG4J2-1003 implements it to log at debug level, and based on what the throwing documentation suggests as use case, AbstractLogger should be logging at debug level:

      throw logger.throwing(myException);
      

      Having an exception which is thrown additionally be logged as error will result in duplicate error messages in the log file (unless the exception handling is broken), one from the throwing call and a second one from the method handling that exception.
      Therefore throwing should in my opinion only log at DEBUG level, similar to how java.util.logging is doing it.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vy Volkan Yazici
                Reporter:
                Marcono1234 Marcono1234
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: