Message / registration from Thin

How can I stop Rack Slim from returning the following initial message types?

→ Thin Web Server (v1.3.1 code name Triple Espresso)
→ The maximum number of connections is 1024
→ istening on 0.0.0.0{000, CTRL + C to stop

I use it as follows:

Rack::Handler::Thin.run(Rack::Builder.new do map("/resource/"){run(Rack::File.new("/"))} map("/") do run(->env{ h = Rack::Utils.parse_nested_query(env["QUERY_STRING"]) [200, {},[routine_to_generate_dynamic_content(h)]] }) end end, Port: 3000) 
+7
source share
2 answers

These messages do not come from the rack, they come from the thin ones: https://github.com/macournoyer/thin/blob/master/lib/thin/server.rb#L150 You can set the logging parameters in accordance with this: https: //github.com/macournoyer/thin/blob/master/lib/thin/logging.rb Thin :: Logging.silent = true, but do you really want to disable everything? Maybe redirect it to a log file instead of stdout?

+2
source

It seems that the initial messages come from Thin . According to their Github issue No. 31, Disable All Logging , you can add Thin::Logging.silent = true to the rest of the code to disable the initial messages.

However, this will also disconnect all other messages from the thin adapter. A look at the source says that these other messages will also be disabled:

  • Waiting for n connection(s) to finish, can take up to n sec, CTRL+C to stop now
  • Stopping ...
  • !! Ruby 1.8.5 is not secure please install cgi_multipart_eof_fix:
    gem install cgi_multipart_eof_fix

Hope this helps!

+4
source

All Articles