8

Why I don't see any Rails specific entries in the logs ?

I'm using Puma 2.7.1 with Nginx proxy, on a normal Debian box, nothing fancy, ruby 1.9.3 via RVM.

My puma config:

#!/usr/bin/env puma
environment 'sandbox'
bind 'unix://tmp/puma.sock'
stdout_redirect 'log/puma.log', 'log/puma_error.log', true
pidfile 'tmp/pids/puma.pid'
state_path 'tmp/pids/puma.state'
daemonize true 
workers 4

I start puma via:

bundle exec puma -C config/puma/config.rb

I see:

[23664] Puma starting in cluster mode...
[23664] * Version 2.7.1, codename: Earl of Sandwich Partition
[23664] * Min threads: 0, max threads: 16
[23664] * Environment: sandbox
[23664] * Process workers: 4
[23664] * Phased restart available
[23664] * Listening on unix://tmp/puma.sock
[23664] * Daemonizing...

I run:

tail -f log/puma*

I see:

==> log/puma_error.log <==
X-Accel-Mapping header missing
=== puma startup: 2014-02-13 14:08:52 +0100 ===
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.

==> log/puma.log <==
=== puma startup: 2014-02-13 14:08:52 +0100 ===
[23670] - Worker 23678 booted, phase: 0
[23670] - Worker 23674 booted, phase: 0
[23670] - Worker 23686 booted, phase: 0
[23670] - Worker 23682 booted, phase: 0

But I don't see any more logs, nothing application related.

When the application raises an exception, I get nothing in the logs... "tabula rasa"

astropanic
  • 10,800
  • 19
  • 72
  • 132

1 Answers1

14

Rails has a seperate log file and doesn't log to the puma log. By default, Rails logs to a file in logs/<environment>.log, e.g. log/production.log

Holger Just
  • 52,918
  • 14
  • 115
  • 123
  • Haha, yes your right of course... My brain was on vacation :) I was missing the logs due to Syslog config. thanks – astropanic Feb 13 '14 at 15:01
  • Hi, what @astropanic say is right. However, I don´t completely agree with him. If I have a look at my development.log, I can see the Rails logs, but I cannot see the stdout logs, in example, I can´t see the puts messages in my code. And maybe it´s because I don´t have any error, but I can´t see the errors neither. I miss these stdout and stderr files (such as in Unicorn). – Rober Nov 15 '14 at 08:09
  • I can't see env specific log file as @Holger has mentioned. I am using nginx & puma for rails – RAJ Feb 05 '15 at 12:49
  • Is there any way to get puma to show the rails logs? Perhaps something in the environment config? – Factor Mystic Feb 10 '15 at 15:34
  • @FactorMystic You can configure Rails to log to STDOUT which will then end up on the puma logs. However, this might posisbly have other side-effects, e.g. intermingled log-blocks from concurrent requests... – Holger Just Feb 10 '15 at 16:00
  • Don't dev env logs to go to stdout by default? eg, `bundle exec rails s` shows the logs, but running puma directly won't show the same output – Factor Mystic Feb 10 '15 at 16:01