graylog-labs / gelf-rb

Ruby GELF library (Graylog Extended Log Format)
https://rubygems.org/gems/gelf
MIT License
153 stars 104 forks source link

GELF in rails seems to ignore log levels completely #25

Closed gravis closed 8 years ago

gravis commented 10 years ago

Hi,

it seems gelf is not relying on rails log levels at all:

  app_name = config.action_mailer.default_url_options.try(:fetch, :host) || Rails.application.class.name.underscore.split('/').tap{|i|i.pop}.join('/')
  config.logger = GELF::Logger.new("172.31.XX.XX", 1515, "LAN", {:host => app_name, :environment => Rails.env, :facility => "rails" })

We have all the message from the DEBUG level in graylog. We're tried to add a :level option:

  config.logger = GELF::Logger.new("172.31.XX.XX", 1515, "LAN", {:host => app_name, :environment => Rails.env, :facility => "rails", :level => GELF::INFO })

we have also added:

config.log_level = :info

with no success. Any idea why this isn't working as expected? We're using latest version of gelf gem (1.4.0)

Thanks

gravis commented 10 years ago

sounds like a (very) old issue:

http://grokbase.com/t/gg/graylog2/125xw6zcbh/gelf-rb-questions

I finally managed to make it work using:

config.logger.level = GELF::INFO
milgner commented 8 years ago

The options hash usually takes string arguments. Specifying 'level' is the correct way. I'll close the ticket since it seems to have been resolved.