Silence Logger?

Chris Adams's Avatar

Chris Adams

31 Jul, 2012 02:59 PM

** [Airbrake] Success: Net::HTTPOK

** [Airbrake] Environment Info: [Ruby: 1.8.7] [Rails: 3.0.14] [Env: production]
** [Airbrake] Response from Airbrake:
<notice>
....

can you really not silence the logger? i looked through the source, and it seems that rack.rb and rails.rb have different ways of configuring the logger, and further airbrake.rb and sender.rb have different was of accessing the logger. and none of it is very friendly to any sort of configuration. i'm shutting these up with the following code for now. but i'd rather the gem wasn't assuming it's OK to scribble to STDOUT.

module Airbrake # v3.1.2
  class << self
    def write_verbose_log(*args);end
  end
  class Sender
    def log(*args);end
  end
end
  1. Support Staff 2 Posted by Morgan on 04 Aug, 2012 12:47 AM

    Morgan's Avatar

    Hello,

    Thank you for raising your issue to our attention. There is not currently a way to easily silence the writing to STDOUT I will raise this issue to the development team's attention for consideration. Thank you for your feedback and patience!

    From,
    Morgan

  2. Support Staff 3 Posted by Herb on 04 Aug, 2012 01:13 AM

    Herb's Avatar

    Agreed, I'll add an option for that in configuration so it's more flexible.

    Thanks for sharing this with us!

  3. Herb closed this discussion on 04 Aug, 2012 01:13 AM.

  4. Herb re-opened this discussion on 05 Aug, 2012 10:10 PM

  5. Support Staff 4 Posted by Herb on 05 Aug, 2012 10:10 PM

    Herb's Avatar

    Hey Chris,

    the option is already added, but it's not mentioned in the readme, so I've forgot about that.

    You don't need to do this sort of monkeypatches to achieve this. Airbrake uses the same logger as your Rails application by default, presumably STDOUT. You can use a different logger to distinguish information related only to Airbrake by using a different logger:

    Airbrake.configure do |config|
      ...
      config.logger = Logger.new("log/airbrake.log")
    end
    

    Where log/airbrake.log is the location of your preferred log file. Just make sure you pass the Logger instance and everything should work as expected.

    I'm adding this info to readme, thank you for bringing this up! :)

  6. Morgan closed this discussion on 04 Oct, 2012 12:54 AM.

Comments are currently closed for this discussion. You can start a new one.