[SERVER-80847] reinforce MONGO_LOGV2_DEFAULT_COMPONENT placement rule Created: 07/Sep/23  Updated: 29/Oct/23  Resolved: 07/Sep/23

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

Type: Bug Priority: Major - P3
Reporter: Billy Donahue Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-80434 CommandRegistry per Service Closed
Related
is related to SERVER-52604 Log from anywhere (normalize MONGO_LO... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Service Arch 2023-09-18
Participants:

 Description   

Rerun the tool from SERVER-52604.

See Slack announcement.
https://mongodb.slack.com/archives/C1MT4NHF0/p1694046326160709
Quoted here:

Hey all, quick memo (more of a reminder):
As you probably know, the #define MONGO_LOGV2_DEFAULT_COMPONENT is necessary in a server .cpp file that wants to use logging.

  • The old rule was that this definition must appear before the #include block at the top of a .cpp file.
  • The new rule is that this definition must appear after the #include block. A complete reversal!

This change happened about 16 months ago in SERVER-52604, which included a codebase sweep. However, since that sweep, 20+ instances of the old style have come in. These old-style definitions may not break anything immediately, but they make it impossible to LOGV2 from headers that they include, and could be trouble for a C++ modules rollout, or cause other subtle modularity problems.
I'm going to do another sweep of the codebase and fix these again (it's easy because I have a tool that does it), but I do want to get the word out.
Thx!

This is really just tracking the work to run the script again.
https://gist.github.com/BillyDonahue/48c2746b9a761e1d1ecc930486d83aa5



 Comments   
Comment by Githook User [ 07/Sep/23 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-80847 Move all MONGO_LOGV2_DEFAULT_COMPONENT defs below includes
Branch: master
https://github.com/mongodb/mongo/commit/bd504cadde9e00003bf2c3465212ccd87006e62b

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