Skip to content

Commit

Permalink
fix multiprocessing logging
Browse files Browse the repository at this point in the history
  • Loading branch information
tilsche committed Aug 21, 2023
1 parent 0d6c34a commit 1b683e2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions metricq_source_snmp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ def mp_worker(
result_queue: queue.Queue[list[DataPoint]],
) -> None:
"""init function of multiprocessing workers"""
# overwrite logger with multiprocessing logger
global logger
# Unfortunately no way to configure easily, but there shouldn't be much debug spam here...
logger = mp.log_to_stderr(logging.DEBUG)
logger.debug(f"[worker {os.getpid()}] Starting event loop")
asyncio.run(start_collectors(host_config, stop_event, result_queue))
logger.debug(f"[worker {os.getpid()}] exited event loop")
Expand Down

0 comments on commit 1b683e2

Please sign in to comment.