Puma 登录到哪里

问题描述 投票:0回答:1

我一直使用 Thin 来运行我的 ruby Sinatra 应用程序,但我现在切换到 Puma。 Thin 创建了自己的日志

log/thin.log
,我使用它。我注意到 Puma 不生成日志文件(我看不到)。我曾尝试在谷歌上搜索有关此问题的文档,但没有真正找到任何内容。

我想知道是否/如何在 Puma 中指定日志路径。

任何帮助将不胜感激。

亚历克斯

ruby logging webserver thin puma
1个回答
19
投票

新答案

存储库的 README 包含有关配置的部分。该存储库还包括一个示例“QC”环境配置,位于 examples/qc_config.rb

默认配置值位于 puma/lib/puma/configuration.rb 供参考。

一些配置值没有详细记录,但在 puma/lib/puma/dsl.rb 定义中有详细说明!

感谢@MDickten 注意到链接已损坏!

例如:

# 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

旧答案

按照存储库的 README 上的建议检查示例 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
© www.soinside.com 2019 - 2024. All rights reserved.