Take the 2-minute tour ×

How can I remove / inspect / modify handlers configured for my loggers using the fileConfig() function?

For removing there is Logger.removeHandler(hdlr) method, but how do I get the handler in first place if it was configured from file?

share|improve this question

1 Answer 1

up vote 11 down vote accepted

logger.handlers contains a list with all handlers of a logger.

share|improve this answer
This is not documented. Is it safe to use it? –  Manish Apr 24 '12 at 19:33
@Manish: Looking at the code, I would say it is safe to use, as long as you don't do multithreading. The handler list is a shared resource protected by a Lock and the list only contains references to the handlers. Don't use it, if you do multithreading. –  Enno Gröper Feb 9 '13 at 11:59

Your Answer


