You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For python 3 LogstashFormatterBase.serialize method returns bytes instead of string. This incosistency results in no possibility in reusing this formatter with buildin handlers like pythons StreamHandlers (e.g. FileHandler), because it expects string object returned from formatter.
For python 2.X LogstashFormatterBase.serialize method behaves correct returning string.
The text was updated successfully, but these errors were encountered:
Same issue here. Python 3.5, when I use LogstashFormatter with FileHandler I get:
--- Logging error ---
Traceback (most recent call last):
File "/usr/local/lib/python3.5/logging/__init__.py", line 982, in emit
stream.write(msg)
TypeError: write() argument must be str, not bytes
The issue is fixed once I override serialize to return json.dumps(message). What maintainers think about removing version check here and using json.dumps for all the versions? It makes sense to convert formatted messages to bytes in handlers before sending to a socket.
For python 3 LogstashFormatterBase.serialize method returns bytes instead of string. This incosistency results in no possibility in reusing this formatter with buildin handlers like pythons StreamHandlers (e.g. FileHandler), because it expects string object returned from formatter.
For python 2.X LogstashFormatterBase.serialize method behaves correct returning string.
The text was updated successfully, but these errors were encountered: