I want to forward all logs to graylog server plus I want to maintain my actual Rails Log. I am using ruby gelf gem. https://github.com/Graylog2/gelf-rb and lograge. In my application.rb I have the code
if Rails.env.in? ['production', 'preproduction', 'staging']
config.lograge.keep_original_rails_log = true
config.lograge.logger = GELF::Logger.new(graylog.example.in", 12219)
end
With This I am getting all the request and response in the graylog server.But I does not sent the explict logging logged like these
Rails.logger.info "#{params}"
So I added this code in application.rb
:
gelf = GELF::Logger.new("graylog.example.in", 12219)
config.logger.extend(ActiveSupport::Logger.broadcast(gelf))
This works from rails console.But does not sent from the application