Disable Sinatra Standard Output

For security reasons, I don't want Sinatra to print every url requested in standard edition, I tried using set :logging, false

as suggested in this answer . using:

class SweetAppName< Sinatra::Base
    set :show_exceptions, false
    set :environment, :production
    set :logging, false

      

However, when I run the application using a funnel and thin, I still see the request logged to the terminal:

127.0.0.1 - - [26 / May / 2015: 09: 32: 34 -0700] "GET / not-a-real-url HTTP / 1.0" 404 - 0.0452

How do I disable them?

+3


source to share


1 answer


If you run your application using rackup

, the Rack will add a middleware software, including logging . You can prevent this by using the silent option ( -q

or --quiet

) before rackup

, that is, from the command line:

$ rackup -q

      

You can enable this option in config.ru

yours if you like, so you don't have to remember it every time you launch the app. The first line begins with #\

, is analyzed as parameters
, so you can be config.ru

as follows:



#\ --quiet

# other middleware etc...
run SweetAppName

      

If you are using the classic style of Sinatra app you need to add a line set :logging, false

, otherwise Sinatra will add its own log. With modular styling (like the one you use in the question) this parameter defaults false

to so you won't need it.

+7


source







All Articles