Reputation: 11746
I've imported a python module, apex (from NVIDIA), which uses its own logger. Unfortunately those logged messages are not getting caught by my main logger, which also writes to a file.
import logging
logger = logging.getLogger(__name__) # my main logger
what I need to do is (somehow) run logging.getLogger("apex.amp") so that I can attach the apex logger to my main logger, and catch the corresponding warnings, etc.
How do I combine the loggers?
Upvotes: 0
Views: 129
Reputation: 106588
You can assign your logger to the 'apex.amp'
key of the loggerDict
dict of the manager
object:
logging.manager.loggerDict['apex.amp'] = logger
Upvotes: 1