On Thu, 1 Aug 2013, Joseph L. Casale wrote:

I have a couple handlers applied to a logger for a file and console destination.
Default levels have been set for each, INFO+ to console and anything to file.

How does one prevent logging.exception from going to a specific handler when
it falls within the desired levels?


There is probably a better way, I'm not too familiar with the more advanced logging, but off the top of my head I'd suggest subclassing the Handler classes that you're interested in and overriding the Handle method (I think - you can check the source to be sure) and if the type of message is exception then just skip handling it.

Alternatively, you could simply create a different logger, e.g.

exc_logger = logging.getLogger('mything.exceptions')


And use that to log exceptions.

Oh hai - as I was reading the documentation, look what I found:

http://docs.python.org/2/library/logging.html#filter

Methinks that should do exactly what you want.

HTH,
W
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to