Skip to content

fix: Replace get_thread_logger with get_logger for consistent logging management#131

Merged
dcloud347 merged 2 commits intomainfrom
dev
Sep 12, 2025
Merged

fix: Replace get_thread_logger with get_logger for consistent logging management#131
dcloud347 merged 2 commits intomainfrom
dev

Conversation

@dcloud347
Copy link
Contributor

This pull request refactors the logging setup throughout the codebase to remove dependencies on the custom logger_manager module and instead use Python's built-in logging module directly. Thread-specific loggers are now created using the thread ID in the logger name, and file handlers are managed explicitly. This change improves maintainability and reduces reliance on custom utilities.

Logging Refactor and Cleanup:

  • Replaced all usages of get_thread_logger and related utilities from prometheus.utils.logger_manager with direct instantiation of loggers using Python's standard logging module and threading.get_ident() to ensure thread-specific loggers. This affects several files including issue_service.py, base_container.py, and multiple nodes under prometheus/lang_graph/nodes/. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]

  • Updated logger initialization in constructors to use logging.getLogger(f"thread-{threading.get_ident()}.{__name__}") instead of the previous custom logger manager, ensuring each thread has a uniquely named logger. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

  • In issue_service.py, replaced custom log file handler management (remove_multi_threads_log_file_handler, clear_current_thread_session) with direct calls to logger.removeHandler and file_handler.close() to clean up file handlers after use.

Dependency Cleanup:

  • Removed all imports of get_thread_logger and related functions from prometheus.utils.logger_manager across the affected files, since logging is now handled directly. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

Thread Safety and Logging Consistency:

  • Ensured that loggers and log file handlers are thread-specific, which improves logging clarity and avoids conflicts in multi-threaded environments. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

These changes modernize and simplify the logging approach, making the codebase easier to maintain and debug in concurrent execution scenarios.

@dcloud347 dcloud347 merged commit 03cbb4b into main Sep 12, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant