Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Improves reliability of LobHlpr.lob_print() logging by making rotating file handler setup thread-safe and clarifying how handlers are attached to ensure logs are written even with propagate=False.
Changes:
- Added a module-level lock to prevent concurrent threads from creating duplicate
RotatingFileHandlers. - Switched handler detection to use an absolute log path and re-check under the lock.
- Adjusted handler attachment to include both the root logger and the
lob_hlprlogger.
Collaborator
Author
|
A few extra things that are nice, but not really that needed... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request improves thread safety and reliability in the logging setup of the
lob_printfunction by introducing a lock to prevent race conditions when multiple threads attempt to configure file handlers simultaneously. Additionally, it clarifies the logic for attaching handlers to loggers. The most important changes are:Thread safety improvements:
threading.Lock(_log_handler_lock) to protect the one-time setup of rotating file handlers inlob_print, ensuring that concurrent threads do not create duplicate handlers or encounter race conditions. [1] [2] [3]Logging handler setup adjustments:
propagate=False), ensuring correct logging behavior.