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
Вопрос
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')