[Mellanox] Correct the wrong log identifiers of platform daemons #3596
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
- What I did
Correct the wrong log identifiers of platform daemons on Mellanox platform
Originally the Logger class was introduced for the daemons running in pmon docker to provide them the ability to log message in an easy way with log identifier initialized as daemon's name.
When platform API is developed the Logger was also used by them with log identifiers initialized as the classes' name.
However, the logger identifier is global of the entire process scope, which means only one instance of log identifier for the entire daemon. As a result, the classes who is lastly loaded will have its classname set to the daemon's log identifier, causing the identifier incorrect in the logging message.
Since the original meaning of log identifier is the name of the daemon but not the modules, only daemons is legal to set the log identifier. All classes shouldn't set the log identifier when instantiate Logger class.
- How I did it
Don't touch log identifier when initialized by classes in platform API.
- How to verify it
config reload and check whether the pmon logs are correct.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)