dwbutler/logstash-logger

Unable to use Ruby Logger as Buffer logger

Closed this issue · 1 comments

I have been trying to debug some issues with logs not being flushed properly and have been unable to set the options[:logger] when constructing a UDP logger.

One issue seems to be that you can't (from the public interface) set the logger for the Buffer to use, but even if I manually edit the source in place and specify it's value as Logger.new($stderr) the method signature for logging methods on the standard logger don't match the call:

 @buffer_config[:logger].debug("Flushing output",
          :outgoing_count => @buffer_state[:outgoing_count],
          :time_since_last_flush => time_since_last_flush,
          :outgoing_events => @buffer_state[:outgoing_items],
          :batch_timeout => @buffer_config[:max_interval],
          :force => force,
          :final => final
        ) if @buffer_config[:logger]

AFAIK the standard ruby logger doesn't have this kind of method: https://ruby-doc.org/stdlib-2.2.0/libdoc/logger/rdoc/Logger.html#method-i-info

Am I missing something?

You aren't missing something. It's weird code that was vendored in from Stud::Buffer.

This is now fixed in 0.20.0.