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

Audit tools for correct handling of log output

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.5.3
    • Affects Version/s: None
    • Component/s: None
    • None

      The logging output in the tools is inconsistent and may cause issues in certain situations.

      For example, in dump.cpp and export.cpp, all output is always sent to log() which uses stdout. This is a problem because mongodump and mongoexport can send actual data to stdout. To fix this, we need to always check the variable _usesstdout from tool.cpp to optionally send log messages to stderr.

      However, some tools use stderr for informational and log messages when it is actually not necessary. Mongorestore does this. In these cases, log messages should go to stdout instead.

      Also, as described in SERVER-2011, there are situations where we are sending data to stdout, but we also don't want informational messages to go to stderr. The --quiet option is meant to solve this problem, and we should make sure that dump.cpp and export.cpp check for this.

      Finally, I think it might be good to make a test to make sure that the --quiet option actually silences all info messages, and to make sure that there aren't any logging messages that interfere with data sent to stdout.

            Assignee:
            sverch Shaun Verch
            Reporter:
            sverch Shaun Verch
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: