How to redirect (Rack) Thin server output to console?
Asked Answered
U

5

10

Thin server has -l option to redirect output to log file (default: log/thin.log). Is there a way like in webrick server the output is always to console (and log/development.log) too ?

Unpin answered 9/11, 2011 at 20:24 Comment(1)
On Sinatra, use enable :logging.Pommard
B
3

My installed version of Thin automatically outputs to the console. If yours doesn't, you could try updating your installed version.

You could also try thin -l -, which tells Thin to redirect output to STDOUT.

Hope this helps!

Brookhouse answered 14/1, 2012 at 2:33 Comment(0)
N
2

If you're using rails, add this to your gemfile:

gem 'thin', :group => 'development'

And then from the console, use:

rails s

This will send logs to standard out and to log/development.log

Don't use "thin start", as some of the docs say.

Nipping answered 1/3, 2012 at 15:57 Comment(0)
A
0

Mine does automatically output into console however if I use a Procfile, it doesn't.

Anode answered 21/2, 2012 at 22:8 Comment(0)
E
0

I use thin start -d to start thin as a background daemon with default logging and send the output of the file back to console with

tail -f log/thin.log

This way the server doesn't stop if terminal closes, but I can see output from puts statements. If you want more detailed logging from thin that's a bit different.

To stop the service/daemon use thin stop

Existential answered 11/4, 2012 at 4:3 Comment(0)
H
0

The solution is to add a small code snippet in your config.ru file, and thin output all app logs to the console, without having to tail the log file and it keeps the log coloring intact

Details here: Thin server: Thin server: ouput rails application logs to console, as 'rails s' does

Hexagram answered 3/3, 2014 at 22:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.