The LogStashLogger fails when encoding some events. Note that the error happens upstream in the logstash-event gem, but I couldn't find where to report that.
Reproduction:
s = "x\xc3x".force_encoding('ASCII-8BIT')
l = Logger.new(STDOUT)
l.info(s)
# fine
# I, [2020-04-06T09:16:57.787645 #39066] INFO -- : x�x
ll = LogStashLogger.new(type: :stdout)
ll.info(s)
# explodes
# Encoding::UndefinedConversionError: "\xC3" from ASCII-8BIT to UTF-8
# from /Users/stefan/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/logstash-event-1.2.02/lib/logstash/event.rb:169:in `to_json'
Expected result:
Handle invalid codepoints like the standard Logger.
The
LogStashLogger
fails when encoding some events. Note that the error happens upstream in thelogstash-event
gem, but I couldn't find where to report that.Reproduction:
Expected result: Handle invalid codepoints like the standard
Logger
.Actual result: Exception.