Closed
Description
Logging exception using _logger.exception(ex)
causes exception inside the fluent
package.
(...)
_logger.exception(ex)
File "/usr/lib64/python2.7/logging/__init__.py", line 1198, in exception
self.error(msg, *args, **kwargs)
File "/usr/lib64/python2.7/logging/__init__.py", line 1191, in error
self._log(ERROR, msg, args, **kwargs)
File "/usr/lib64/python2.7/logging/__init__.py", line 1284, in _log
self.handle(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 1294, in handle
self.callHandlers(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 1334, in callHandlers
hdlr.handle(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 757, in handle
self.emit(record)
File "/home/bozydar/workspaces/data-mining/venv/lib/python2.7/site-packages/fluent/handler.py", line 106, in emit
self.sender.emit(None, data)
File "/home/bozydar/workspaces/data-mining/venv/lib/python2.7/site-packages/fluent/sender.py", line 54, in emit
self.emit_with_time(label, cur_time, data)
File "/home/bozydar/workspaces/data-mining/venv/lib/python2.7/site-packages/fluent/sender.py", line 57, in emit_with_time
bytes_ = self._make_packet(label, timestamp, data)
File "/home/bozydar/workspaces/data-mining/venv/lib/python2.7/site-packages/fluent/sender.py", line 68, in _make_packet
return msgpack.packb(packet)
File "/home/bozydar/workspaces/data-mining/venv/lib/python2.7/site-packages/msgpack/__init__.py", line 47, in packb
return Packer(**kwargs).pack(o)
File "msgpack/_packer.pyx", line 223, in msgpack._packer.Packer.pack (msgpack/_packer.cpp:223)
File "msgpack/_packer.pyx", line 225, in msgpack._packer.Packer.pack (msgpack/_packer.cpp:225)
File "msgpack/_packer.pyx", line 213, in msgpack._packer.Packer._pack (msgpack/_packer.cpp:213)
File "msgpack/_packer.pyx", line 184, in msgpack._packer.Packer._pack (msgpack/_packer.cpp:184)
File "msgpack/_packer.pyx", line 220, in msgpack._packer.Packer._pack (msgpack/_packer.cpp:220)
exceptions.TypeError: can't serialize ValueError('No JSON object could be decoded',)
Used configuration:
logger = logging.getLogger('sentiment')
logger.addHandler(logging.StreamHandler(sys.stdout))
logger.setLevel('DEBUG')
custom_format = {
'host': '%(hostname)s',
'where': '%(module)s.%(funcName)s',
'type': '%(levelname)s',
'stack_trace': '%(exc_text)s'
}
h = handler.FluentHandler('sentiment', host='localhost', port=24224)
formatter = handler.FluentRecordFormatter(custom_format)
h.setFormatter(formatter)
logger.addHandler(h)
Metadata
Metadata
Assignees
Labels
No labels