Uploaded image for project: 'CDAP'
  1. CDAP
  2. CDAP-12552

Fix error logging in HttpExceptionHandler

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.3.0
    • Fix Version/s: 4.3.1
    • Component/s: Log
    • Labels:
      None
    • Rank:
      1|i007lj:

      Description

      When using Logger's logging APIs, a Throwable can be passed as the last argument, and the exception's message and stacktrace will be included as part of the log.
      However, if using the Logger's built-in string formatting capabilities, this is no longer possible.

      For instance, this will log a stacktrace:
      LOG.error("This is some logging", new NullPointerException());
      However, the following will NOT log a stacktrace:
      LOG.error("This is some {} logging", "unexpected" new NullPointerException());

      Because of this, HttpExceptionHandler is not logging the exception stack trace, nor is it logging any causal exceptions, and so debugging can be made difficult or impossible.

      If a Throwable is going to be logged as part of the log message, then the Logger's string formatting can not be utilized and String.format will have to be manually used.

        Attachments

          Activity

            People

            • Assignee:
              bhooshan Bhooshan Mogal
              Reporter:
              ali.anwar Ali Anwar
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: