Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8343440

Resolve Multiline Message Parsing Ambiguities in Unified Logging

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 24
    • hotspot
    • behavioral
    • low
    • Current tools that parse Unified Logging output may break after the proposed changes. Updating the tools is straightforward and should also simplify the tool implementations.
    • File or wire format
    • Implementation

      Summary

      Newlines that are part of Unified Logging messages can result in parsing ambiguities. We resolve the parsing ambiguities by annotating newlines in log messages with a special decorator.

      Problem

      Consider the Unified Logging output resulting from log_info(gc)("A\n[gc] B");:

      [gc] A
      [gc] B

      We cannot recover the fact that this is a single log message "A\n[gc] B". A tool parsing this output will likely incorrectly identify two separate log messages "A" and "B". We should ensure that such parsing ambiguities can never occur.

      Solution

      We propose to add a special decorator at newlines in log messages to allow unambiguous parsing.

      Review and mailing list threads:

      Specification

      We propose to add the special decorator [ ] followed by a space at newlines in log messages, where we choose the number of spaces between the brackets to align with the log message decorator. For example, the output resulting from log_info(gc)("A\n[gc] B"); is now

      [gc] A
      [  ] [gc] B

      and we can parse it unambiguously. As an added bonus, the log message also aligns properly, generally improving readability.

            dlunden Daniel Lunden
            jsjolen Johan Sjölen
            David Holmes, Johan Sjölen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: