Where does Puma log to
Asked Answered
M

1

15

I have been using Thin to run my ruby Sinatra applications but I am now switching over to Puma. Thin creates its own log log/thin.log which I use. I noticed that Puma doesn't produce a log file (not that I can see). I have tried googling for documentation around this but not really found anything.

I was wondering if/how you can specify a log path in Puma.

Any help would be much appreciated.

Alex

Magi answered 1/3, 2014 at 19:57 Comment(0)
P
19

New answer

The repo's README includes a section on configuration. The repo also includes an example "QC" environment config located at examples/qc_config.rb.

Default configuration values are located in puma/lib/puma/configuration.rb for reference.

Some configuration values aren't well documented, but are detailed in the puma/lib/puma/dsl.rb definition!

Thanks to @MDickten for noticing that the links had broken!

For example:

# example_config.rb
#
# Redirect STDOUT and STDERR to files specified. The 3rd parameter
# (“append”) specifies whether the output is appended, the default is “false”.


stdout_redirect '/u/apps/lolcat/log/stdout', '/u/apps/lolcat/log/stderr'
stdout_redirect '/u/apps/lolcat/log/stdout', '/u/apps/lolcat/log/stderr', true

Old answer

Check the example config.rb as recommended on the repo's README.

As shown there:

# Redirect STDOUT and STDERR to files specified. The 3rd parameter
# (“append”) specifies whether the output is appended, the default is “false”.


stdout_redirect '/u/apps/lolcat/log/stdout', '/u/apps/lolcat/log/stderr'
stdout_redirect '/u/apps/lolcat/log/stdout', '/u/apps/lolcat/log/stderr', true
Pastorale answered 1/3, 2014 at 20:43 Comment(3)
Is it possible to redirect to a logger (an object) instead of a file?Traumatism
I had the same question as @yegor256. I used a hack to make it working by adding following to my config log = Syslog::Logger.new 'my_app'; log_formatter { |s| log.info s; s }.Gradely
The links are dead. You can click around to find a config file under github.com/puma/puma/blob/master/examples/qc_config.rb, but I don't think it's what is wanted here.Turbot

© 2022 - 2024 — McMap. All rights reserved.