-
Type:
CSR
-
Resolution: Approved
-
Priority:
P4
-
Component/s: 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:
- https://github.com/openjdk/jdk/pull/21712
- https://mail.openjdk.org/pipermail/hotspot-dev/2024-October/095207.html
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.
- csr of
-
JDK-8288298 Resolve multiline message parsing ambiguities in UL
-
- Resolved
-