문제

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.

도움이 되었습니까?

해결책 2

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

다른 팁

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')
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top