From: Vinay Sajip Date: Sat, 4 Aug 2012 22:40:21 +0000 (+0100) Subject: Issue #15541: Correct anomaly in logging.exception. Thanks to Ned Batchelder for... X-Git-Tag: v2.7.5~109^2~406 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=947f358a069c9141c0230e440ab5cba07df0f87f;p=python Issue #15541: Correct anomaly in logging.exception. Thanks to Ned Batchelder for the report. --- diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index d214aabbcc..1ae531f338 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1173,11 +1173,12 @@ class Logger(Filterer): if self.isEnabledFor(ERROR): self._log(ERROR, msg, args, **kwargs) - def exception(self, msg, *args): + def exception(self, msg, *args, **kwargs): """ Convenience method for logging an ERROR with exception information. """ - self.error(msg, exc_info=1, *args) + kwargs['exc_info'] = 1 + self.error(msg, *args, **kwargs) def critical(self, msg, *args, **kwargs): """ @@ -1582,12 +1583,13 @@ def error(msg, *args, **kwargs): basicConfig() root.error(msg, *args, **kwargs) -def exception(msg, *args): +def exception(msg, *args, **kwargs): """ Log a message with severity 'ERROR' on the root logger, with exception information. """ - error(msg, exc_info=1, *args) + kwargs['exc_info'] = 1 + error(msg, *args, **kwargs) def warning(msg, *args, **kwargs): """