-
Type:
Improvement
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Networking & Observability
-
Fully Compatible
-
N&O 2025-03-03
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
This came up in #server-programmability.
We actually don't support those anymore. There's no text conversion happening that will expand those "{expr}" tags (the log output will literally just be "{jsError}" or whatever. So I assume there's no incentive to change the message string this way.
The logv2 arch guide still contains incorrect information about this, unfortunately.
https://github.com/10gen/mongo/blob/master/docs/logging.md#basic-usage
Replacement fields are placed in the format string with curly braces {}. Everything not surrounded with curly braces is part of the message text. Curly brace characters can be output by escaping them using double braces: {{ or }}.
...
Attributes are associated with replacement fields in the format string by name or index, using names is strongly recommended. When using unnamed replacement fields, attributes map to replacement fields in the order they appear in the format string.
It is allowed to have more attributes than replacement fields in a log statement. However, having fewer attributes than replacement fields is not allowed.
None of that is true anymore. Note that there's no format string mentioned elsewhere. These paragraphs were just left behind by accident.