【发布时间】:2026-02-05 07:20:06
【问题描述】:
它在我的配置中的哪个位置写到 production.log 文件?
对此的最佳做法是什么,仅记录我猜测的严重错误,我该怎么做?
【问题讨论】:
标签: ruby-on-rails
它在我的配置中的哪个位置写到 production.log 文件?
对此的最佳做法是什么,仅记录我猜测的严重错误,我该怎么做?
【问题讨论】:
标签: ruby-on-rails
默认情况下,日志文件是环境名称的约定。所以在生产环境中日志将被命名为production.log,在开发中它被称为development.log。
您可以在config/environments/production.rb 中添加以下行来覆盖日志文件名和生产日志级别。
config.log_level = :error # this will the rails to log error only in production
config.log_path = log/something_else.log # defaults to log/#{environment}.log
【讨论】: