[SERVER-9282] Audit tools for correct handling of log output Created: 08/Apr/13  Updated: 11/Jul/16  Resolved: 11/Oct/13

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 2.5.3

Type: Task Priority: Minor - P4
Reporter: Shaun Verch Assignee: Shaun Verch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-2011 mongodump, bsondump and mongoexport s... Closed
Related
related to TOOLS-140 bsondump produces invalid JSON Closed
is related to SERVER-9268 Use existing logging framework to sta... Closed
Participants:

 Description   

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.



 Comments   
Comment by auto [ 11/Oct/13 ]

Author:

{u'username': u'Zarkantho', u'name': u'Shaun Verch', u'email': u'shaun.verch@10gen.com'}

Message: SERVER-9282 Audit tools for correct handling of log output
Branch: master
https://github.com/mongodb/mongo/commit/0502950b1cf05c64f1a367e00911c06baa65688a

Comment by Samantha Ritter (Inactive) [ 03/Oct/13 ]

Added a comment about mongorestore. In more detail:

> mongorestore --db digg out.bson

This command is not sending data to stdout, so informational messages should be routed to stdout. Instead, they go to stderr. sverch explained that this might be related to code that is shared between mongorestore and bsondump, where using stderr is hard-coded in.

Generated at Thu Feb 08 03:19:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.