[SERVER-23810] Don't Print Shell Log Messages to STDOUT When --quiet Is Used Created: 19/Apr/16  Updated: 06/Dec/22  Resolved: 03/Dec/21

Status: Closed
Project: Core Server
Component/s: Security, Shell
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Ilya Ivanov Assignee: Backlog - Server Tooling and Methods (STM) (Inactive)
Resolution: Won't Fix Votes: 5
Labels: move-stm
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-27159 shell logs output of ReplicaSetMonito... Closed
related to SERVER-19048 shell types a help message even when ... Closed
related to SERVER-4391 --eval should be affected by the --qu... Backlog
related to SERVER-542 Include --quiet option Closed
Assigned Teams:
Server Tooling & Methods
Operating System: ALL
Participants:

 Description   

C:\MongoDB\bin>mongo
2016-04-19T14:13:20.172-0400 I CONTROL [main] Hotfix KB2731284 or later update is installed, no need to zero-out data files
MongoDB shell version: 3.2.5
connecting to: test

May we please have a way of getting rid of this warning message?
Even --quiet doesn't help.
This is extremely annoying as it ends up in stdout and thus in any file I would redirect the output to.

What is especially annoying is that the warning is there no matter if I have the hotfix installed or not. This is what I used to get before I got the hotfix installed:

C:\MongoDB\bin>mongo.exe
2016-04-19T15:13:29.709-0400 I CONTROL [main] Hotfix KB2731284 or later update is not installed, will zero-out data files
MongoDB shell version: 3.2.5
connecting to: test



 Comments   
Comment by Brooke Miller [ 03/Dec/21 ]

We've deprecated the mongo shell in favor of the new mongosh. Unfortunately, we aren't able to pursue improvements to the deprecated shell except in extreme cases, such as critical security fixes. Please start making use of mongosh and let us know if it works for you in this case.

Comment by Dave Macias [ 27/Sep/19 ]

Same issue with v4.0.12

 

cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)  
 

MongoDB shell version v4.0.12
git version: 5776e3cbf9e7afe86e6b29e22520ffb6766e95d4
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
allocator: tcmalloc
modules: none
build environment:
    distmod: rhel70
    distarch: x86_64
    target_arch: x86_64
 

 
mongo --host rs0/ip,ip,ip --eval 'db.blabla.find({"userId": "testuser1"}).pretty()' bladb --quiet | tail 
 2019-09-27T12:49:22.576+0000 I NETWORK [js] Starting new replica set monitor for rs0/IP:27017,IP:27017,IP:27017
 2019-09-27T12:49:22.583+0000 I NETWORK [js] Successfully connected to IP:27017 (1 connections now open to IP:27017 with a 5 second timeout)
 2019-09-27T12:49:22.586+0000 I NETWORK [js] Successfully connected to IP:27017 (1 connections now open to IP:27017 with a 5 second timeout)
 2019-09-27T12:49:22.743+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to IP:27017 (1 connections now open to IP:27017 with a 5 second timeout)

 

Comment by Apostrophe Cloud [ 26/Sep/19 ]

Not just a Mac issue. Seeing it in 3.6.14 on CentOS 7 when connecting to an Atlas URI. It is a bummer that --quiet isn't really usable. Still figuring out what I can even do short of wrapping a node script or praying I'm filtering out all the right noise.

Comment by Eric Milkie [ 16/May/18 ]

The new task in this ticket, as described, is to not print "log messages". Does that include all shell output other than JSON responses to commands?
For example, is the prompt for an SSL certificate password included as a log message? Or connection error messages? Are messages output via std::cout included as log messages, or only output that goes through the logger?
I think the end result is that we want functionality that separates the JSON responses to commands from all other messages (via separate FD's, possibly), and that other messages are restricted to only errors and nothing interactive. This ticket as currently defined may take us in a step in that direction but more work will be necessary.

Comment by Ilya Ivanov [ 16/May/18 ]

@Matt Lord, yes, absolutely: --quiet being quiet is the main purpose.

Even without --quiet though, I'm not sure the message is still useful, as @Eric Milkie has pointed out above.

Comment by Matt Lord (Inactive) [ 16/May/18 ]

zzayats, are you OK with me generalizing this? I believe the real Task is this: Don't Print Log Messages to STDOUT When --quiet is Used

But I wanted to double check with you first. Thank you for the ticket, and thank you for using MongoDB! 

Comment by Eric Milkie [ 16/May/18 ]

This message is printed via a MONGO_INITIALIZER just like the Hotfix message. It's only for the Apple implementation of SSL, and the message is of little utility (we don't print any such message for any other platforms...), so we should remove it.

Comment by Jonathan Abrahams [ 16/May/18 ]

In version 3.7.5 we now see this message:

mongo --quiet --nodb
2018-05-16T10:00:38.842-0400 I NETWORK  [main] Secure Transport Initialized

Comment by Ilya Ivanov [ 19/Apr/16 ]

Windows 7 64

Generated at Thu Feb 08 04:04:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.