New submission from Артем Меженин: Hello. I noticed strange behavior of logging module, when debugging my code:
$ python Python 2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import logging >>> logging.error('asdf') ERROR:root:asdf >>> logging.error('asdf', extra={'msg':123}) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/logging/__init__.py", line 1575, in error root.error(msg, *args, **kwargs) File "/usr/lib/python2.7/logging/__init__.py", line 1166, in error self._log(ERROR, msg, args, **kwargs) File "/usr/lib/python2.7/logging/__init__.py", line 1257, in _log record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra) File "/usr/lib/python2.7/logging/__init__.py", line 1235, in makeRecord raise KeyError("Attempt to overwrite %r in LogRecord" % key) KeyError: "Attempt to overwrite 'msg' in LogRecord" Originally code was extra=locals() and 'msg' was local variable, but it doesn't matter. ---------- messages: 192744 nosy: amezhenin priority: normal severity: normal status: open title: logging.error('asdf', extra={'msg':123}) raise KeyError exception _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18413> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com