Problem summary
Certain usage patterns of the Python logging framework that work fine outside of Katana cause tracebacks within the application.
Logging with an exception works without issue with standard logging handlers, but with the KatanaLoggingHandler.py, this causes a traceback. For example, the following code:
import logging
try:
raise ValueError("Oops")
except Exception as e:
logging.warning(e)
This works without issue if executed from a standard Python shell. If run from within Katana, it results in a traceback similar to the following:
File "<string>", line 9, in <module>
logging.warning(e)
File "C:\Program Files\Katana2.5v4/bin/lib\logging\__init__.py", line 1590, in warning
root.warning(msg, *args, **kwargs)
File "C:\Program Files\Katana2.5v4/bin/lib\logging\__init__.py", line 1152, in warning
self._log(WARNING, msg, args, **kwargs)
File "C:\Program Files\Katana2.5v4/bin/lib\logging\__init__.py", line 1258, in _log
self.handle(record)
File "C:\Program Files\Katana2.5v4/bin/lib\logging\__init__.py", line 1268, in handle
self.callHandlers(record)
File "C:\Program Files\Katana2.5v4/bin/lib\logging\__init__.py", line 1308, in callHandlers
hdlr.handle(record)
File "C:\Program Files\Katana2.5v4/bin/lib\logging\__init__.py", line 748, in handle
self.emit(record)
File "bin\python\Main\KatanaLoggingHandler.py", line 35, in emit
TypeError: argument 3 must be string, not exceptions.ValueError
Steps to reproduce
Run the above code snippet inside the Katana Python Console as well as in an external Python interpreter. Inside Katana, the code produces a traceback, in the standard interpreter it does not.
Reproduced by support
Katana 2.5v1, 2.5v4 Windows 7
Katana 1.6v3, 2.0v1, 2.0v5, 2.1v1, 2.1v5, 2.5v1, 2.5v4 RHEL 6.6
Expected behaviour
Using the Python logging module inside Katana should give the same results as using the code in an external Python shell.
Actual behaviour
Some usage patterns that work without problem outside Katana cause tracebacks inside the application.