1

I'm looking for a way to prevent logging of health-check requests to my application. I can see that these projects are using Rack::CommonLogger, but I haven't been able to find anything in the documentation on ignoring certain requests.

Jonathan
  • 1,241
  • 9
  • 16

2 Answers2

2

Since I asked for a sinatra/padrino solution I thought I'd answer the question for padrino which I was able to figure out thanks to Qatsi's answer sparking a more informed search.

In my app/app.rb I moved the healthcheck into its own application that looked something like this:

class MyApplicationHealth < Padrino::Application
  set :logging, false
  get(:index) { 'OK' }
end

And then in config/apps.rb I mounted that application at the healthcheck point like this:

Padrino.mount("MyApplicationHealth").to('/myapplicationhealthcheckuri')
Community
  • 1
  • 1
Jonathan
  • 1,241
  • 9
  • 16
0

If you have a modular application try to split this part (i.e. part used for health check) to separate module and use something like that:

class NonLogged < Sinatra::Base
  configure :production, :development do
    enable :logging
  end
  ...
end
sashaegorov
  • 1,821
  • 20
  • 26
  • Thanks, your helped me figure out how to do it for Padrino. I was expecting the answer to be the same for both since I was thinking it was a logger configuration question. – Jonathan Dec 04 '12 at 15:04