Uploaded image for project: 'OpenDJ'
  1. OpenDJ
  2. OPENDJ-6710

Use a single method for generating log error messages and stack traces if needed

    Details

    • Type: Task
    • Status: Dev in Progress
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 7.0.0
    • Fix Version/s: None
    • Component/s: core apis, logging
    • Labels:
      None

      Description

      Motivation: OPENDJ-6528 and OPENDJ-6505.

      We could do with rationalizing some of our exception logging. At the moment we have many methods that output different varieties of exception message:

      • com.forgerock.opendj.util.StaticUtils#getExceptionMessage - this is the method used for the CME in this bug. It does not include any stack trace when the main exception has a message
      • com.forgerock.opendj.util.StaticUtils#stackTraceToSingleLineString(java.lang.StringBuilder, java.lang.Throwable, boolean)
      • com.forgerock.opendj.util.StaticUtils#stackTraceToSingleLineString(java.lang.Throwable, boolean) - delegates to method above
      • org.opends.server.util.StaticUtils#getBacktrace
      • org.opends.server.util.StaticUtils#getExceptionMessage - does some stuff then delegates to SDK equivalent
      • org.opends.server.util.StaticUtils#stackTraceToSingleLineString - delegates to SDK
      • org.opends.server.util.StaticUtils#stackTraceToString(java.lang.Throwable) - no delegation

      I wonder if we could replace all these with a single method that combines getExceptionMessage(), which handles recognized exception types, then fall through to stackTraceToSingleLineString() with full stack always set to true for unrecognized exceptions.

      Additional input from Jean-Noël Rouvignac: I see a lot of code calling e.getMessage() or e.getLocalizedMessage() (Java exceptions) or e.getMessageObject() (OpenDJ exceptions). I would ban them all in favour of a single call to StaticUtils.getExceptionMessage(e) which does the right thing (TM).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nicolas.capponi@forgerock.com Nicolas Capponi
                Reporter:
                matthew Matthew Swift
                Dev Assignee:
                Nicolas Capponi
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: