[SERVER-46382] Alter LOGV2 behavior in the presence of missing attributes Created: 24/Feb/20  Updated: 29/Oct/23  Resolved: 27/Feb/20

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

Type: Bug Priority: Major - P3
Reporter: Mira Carey Assignee: Henrik Edin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-46376 Fix format specifier in LOGV2 stateme... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Dev Tools 2020-02-24, Dev Tools 2020-03-09
Participants:

 Description   

It's my understanding that LOGV2 expressions throw when presented with attribute substitutions in the message that are not present in the overall expression. I'd like them to be fatal in debug builds and non-throwing elsewhere (perhaps logging some extra context that an attribute is missing).

Failure to do this will turn typos in log statements in exception unsafe areas of code into fatal errors in production, which feels excessive.



 Comments   
Comment by Githook User [ 27/Feb/20 ]

Author:

{'name': 'Henrik Edin', 'username': 'henrikedin', 'email': 'henrik.edin@mongodb.com'}

Message: SERVER-46382 Add exception handler so log statements do not throw.

Exceptions during log is fatal in debug builds only
Branch: master
https://github.com/mongodb/mongo/commit/d9a897e34f1e9092dc6117485bd67ab860c12f73

Comment by Andy Schwerin [ 24/Feb/20 ]

We’re still using the text logs in some codepaths, though, right? Unit tests, at least for now.

Comment by Henrik Edin [ 24/Feb/20 ]

This applies to the plain and text formatter as the JSON one does not perform libfmt formatting.

Generated at Thu Feb 08 05:11:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.