[CXX-85] C++ driver DBClientReplicaSet pollutes stdout with logging information Created: 22/Apr/11  Updated: 04/May/14  Resolved: 22/Apr/14

Status: Closed
Project: C++ Driver
Component/s: None
Affects Version/s: None
Fix Version/s: legacy-0.8.0

Type: Bug Priority: Major - P3
Reporter: Leon Mergen Assignee: Unassigned
Resolution: Done Votes: 2
Labels: cxxmove, legacy-cxx
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related

 Description   

The C++ driver's DBClientReplicaSet seems to pollute our stdout with logging information:

Fri Apr 22 16:02:25 updated set (tsukku) to: tsukku/localhost:27017,dev.tsukku.eu:27017
Fri Apr 22 16:02:25 updated set (tsukku) to: tsukku/localhost:27017,dev.tsukku.eu:27017,dev.tsukku.eu:27018
Fri Apr 22 16:02:25 [ReplicaSetMonitorWatcher] starting

I assume it's due to a misconfiguration in the logging commands, since these shouldn't be emitted to stdout.



 Comments   
Comment by Githook User [ 22/Apr/14 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: CXX-85 Add an example of how to inject a custom logger
Branch: legacy
https://github.com/mongodb/mongo-cxx-driver/commit/9d4eebcb0b51f0f9db7c8a745bce8bd419bdf970

Comment by Githook User [ 22/Apr/14 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: CXX-85 Strip server specific logging and default driver to not log
Branch: legacy
https://github.com/mongodb/mongo-cxx-driver/commit/4cf5b8d51be70a5c9bb53c4a34de4fe9b57e3dfe

Comment by Andrew Morrow (Inactive) [ 22/Apr/14 ]

https://github.com/mongodb/mongo-cxx-driver/pull/63

Comment by Troy Heron [ 21/May/13 ]

I'm now using this ugly work-around for this problem:

FILE* nullLog = fopen("/dev/null", "w");
if (nullLog != nullptr) mongo::Logstream::setLogFile(nullLog);

Comment by Troy Heron [ 18/May/13 ]

I agree with this for sure. It makes it pretty much impossible to provide any level of polish to an application using mongodb and replica sets that also uses stdout itself.

It should be possible to make the driver not do any output at all to stdout or stderr.

Comment by Leon Mergen [ 22/Apr/11 ]

Yeah I'm using connection pooling, and there are very little extra messages. But, for example, when running our automated tests, we constantly see these log messages because lots of connections get created / dropped, making the real output unreadable.

In the end it's not a major issue, it's an inconvenience; however, I do think it's inappropriate for a database driver to show this behaviour (by default).

Comment by Eliot Horowitz (Inactive) [ 22/Apr/11 ]

Are you using connection pooling?
If you do, should have very little extra messages.

Comment by Leon Mergen [ 22/Apr/11 ]

I'm seeing it every time a new connection is established indeed.

Making it configurable would be a good idea, but I generally think that it's kind of weird for a database driver to pollute the stdout.

Comment by Eliot Horowitz (Inactive) [ 22/Apr/11 ]

not really misconfiguration, its how we want it for our use cases.
we can make it configurable.
you should only be seeing it once per startup, are you seeing it more?

Generated at Wed Feb 07 21:58:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.