Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-49745

Subtle undocumented difference between LOGV2 and LOGV2_INFO.

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Logging
    • None
    • Server Security
    • Security 2020-09-21

      There's a subtlety that is disorienting, between LogSeverity::Log and LogSeverity::Info, because they appear identical in the log output, but they respond to verbosity filters as distinct severity levels.  the `Log` severity is 0, and the `Info` severity is -1. These severities, though distinct internally, will both appear as an "s":"I" in the log output.

      As a result, it's unclear to users when to use LOGV2_INFO and when to use the default LOGV2. Guidance and documentation on this severity folding behavior would helpful.

      === Slack transcript (or approximation thereof) ===

      Billy Donahue Today at 2:23 PM
      no, you're off by one there . The default is LogSeverity::Log, which is LogSeverity(0). LOGV2_INFO goes to LogSeverity::Info, which is LogSeverity(-1). (edited)
      14 replies

      louis.williams 31 minutes ago
      What is the difference in the log output?

      louis.williams 31 minutes ago
      Also, there isn’t any guidance when to use one or the other.

      The severity appears in the "s" key of the json output object.
      And I think you are right about the missing guidance. I looked around a bit and didn't find any.

      Just testing locally, the “s” field is “I” for both LOGV2 and LOGV2_INFO

      https://github.com/mongodb/mongo/blob/master/src/mongo/logv2/log_severity.cpp#L69 <=where the magic happens.

      I think it's definitely worth a ticket. That line in log_severity.cpp is very subtle and needs user-facing documentation.
      I think they're affected by verbosity filtering differently, even though they appear indistinguishable in the log.

            Assignee:
            backlog-server-security [DO NOT USE] Backlog - Security Team
            Reporter:
            billy.donahue@mongodb.com Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: