[SERVER-85138] guide for log messages and debug levels Created: 29/Jul/14  Updated: 12/Jan/24  Resolved: 19/Aug/14

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

Type: Task Priority: Major - P3
Reporter: Benety Goh Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: community-team
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-5092 Better named logging with tracing Closed
related to SERVER-14729 Add log component to non-debug messages Closed
is related to SERVER-14415 log component hierarchy Closed
is related to SERVER-14416 support use of BSON configuring sever... Closed
is related to DOCS-3694 Document named logging Closed
is related to SERVER-4217 add log severity and component name t... Closed
Sprint: Server 2.7.5, Server 2.7.6
Participants:

 Description   

Provide guidelines on log message style and assigning appropriate debug log levels (LOG() macro).

Debug Logging Enhancements:
https://docs.google.com/a/10gen.com/document/d/1Ab2j_jpr9wjS1fS3n3fVpC3PiFPW8HiSvjHhG8rkWjc/edit?usp=sharing

Logging Module Spec (March 2013):
https://wiki.10gen.com/display/10GEN/Logging+module

Outline:

Top of file (before platform/basic.h)
#define MONGO_LOG_DEFAULT COMPONENT ::mongo::logger::LogComponent::kSharding

Always include mongo/util/log.h where logging is done.

No more logging in headers

  • mongo/util/log.h has been modified to prevent multiple inclusion (indirectly disallowing its use in headers)

severe(), error(), warning(), log() and LOG() will use log component defined in MONGO_LOG_COMPONENT_DEFAULT is available. Otherwise defaults to LogComponent::kDefault.

severe(), error(), warning(), log() will accept optional log component argument if MONGO_LOG_COMPONENT is not appropriate for the current scope.

For configuration, see mongo db manual for logComponentVerbosity server parameter or systemLog.component YAML configuration option.



 Comments   
Comment by Benety Goh [ 19/Aug/14 ]

Changes have been made to:
https://github.com/10gen/mongodb-www-about
(Thanks kay.kim@10gen.com!)

WRITING-954 define default log component
https://github.com/10gen/mongodb-www-about/commit/ab9e88c12a705e1f9cb2a99b61a9cc49d12981d0#diff-2acd125bfb1e1b15271b8b0157d2ffdc

WRITING-954: fix dangling prep
https://github.com/10gen/mongodb-www-about/commit/8c622c25fee85d54b36862353532e8ccf321b372#diff-2acd125bfb1e1b15271b8b0157d2ffdc

WRITING-954: fix gerund
https://github.com/10gen/mongodb-www-about/commit/91ede779fae1a91d912b6b1ba62b1df601376c11#diff-2acd125bfb1e1b15271b8b0157d2ffdc

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