开发者

Sinatra: three logs

开发者 https://www.devze.com 2023-01-27 05:18 出处:网络
I\'m using a very simple Sinatra app that works well. However, every log message is repeated three times. I can bring that down to two by disabling the Sinatra logging with

I'm using a very simple Sinatra app that works well. However, every log message is repeated three times. I can bring that down to two by disabling the Sinatra logging with

d开发者_如何学Goisable :logging

but I still have two. The messages are slightly different, so I gather they are coming from Rack and somewhere else in the stack too.

How do I completely disable logging of successful web requests?


Rack is adding own logging as a middleware try to run

rackup -E none

This removes one log entry. The second one is sinatra native which you've already disable. And the third one is Rack::Lint logging if I remember correctly. General approach is to restructure your app like

app.rb

require 'sinatra/base'
class App < Sinatra::Base
  get '/' do
    "hello"
  end
end

config.ru

require 'myapp'
run MyApp 

Or you can run app outside rack

if __FILE__ == $0
  App.run!
end
0

精彩评论

暂无评论...
验证码 换一张
取 消