graylog-labs / gelf-rb

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

Empty log messages generate exceptions in the Notifier class #12

Closed tomdz closed 6 years ago

tomdz commented 11 years ago

Rails likes to log empty lines, particularly ActionView. Unfortunately that triggers an exception in the Notifier#check_presence_of_mandatory_attributes method because the short_message value is an empty string. This change ensures that messages send to the Notifier always have a non-empty short_message field. Empty log lines and hashes without a short_message value will be ignored. This change also allows to specify the facility in the log message if it is a hash which is useful when used in combination with other logging frameworks or even in your logging own code.

lennartkoopmann commented 11 years ago

Can you add a simple test for the empty log lines handling? Thank you very much!

tomdz commented 11 years ago

@lennartkoopmann: I've added a couple tests for the change.

lennartkoopmann commented 11 years ago

Thank you! Will test tonight or tomorrow and then happily merge.

arsduo commented 11 years ago

I just ran into this issue today myself -- fortunately we have a wrapper class that makes it easy to work around, but it would be great to get this merged into the gem too.

joschi commented 9 years ago

Thanks for this patch!

@tomdz Could you please sign the TORCH Contributor Agreement as outlined in CONTRIBUTING.md and send it to hello@torch.sh?

paulRbr commented 8 years ago

Hi guys, any news about this patch ? Would be great to make it to master. If needed I'll be happy to make this go forward. (I've rebased this branch here: https://github.com/paulRbr/gelf-rb/tree/tomdz/short_message_fix)

jalogisch commented 6 years ago

as of missing updates i'll close this PR now - We would like to merge that if we receive a new PR, based on master branch and with a signed CLA