Daya Sharma
Daya Sharma

Reputation: 3115

How to redirect (Rack) Thin server output to console?

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 ?

Upvotes: 10

Views: 4955

Answers (5)

Benjamin Bouchet
Benjamin Bouchet

Reputation: 13181

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

Upvotes: 0

James EJ
James EJ

Reputation: 2154

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

Upvotes: 0

THEM
THEM

Reputation: 204

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.

Upvotes: 2

oky_sabeni
oky_sabeni

Reputation: 7822

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

Upvotes: 0

ligfx
ligfx

Reputation: 456

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!

Upvotes: 3

Related Questions