yll*_*ate 7 logging ruby-on-rails heroku ruby-on-rails-3 ruby-on-rails-3.1
目前我正在Heroku Celadon Cedar上运行一个Rails 3.1.x应用程序,似乎日志冗长非常缺乏.我已经将日志级别设置为DEBUG a la heroku config:add LOG_LEVEL=DEBUG --app app_name
,这与他们的推荐相符,但是除此之外我似乎无法提取log/*文件内容.
从Thin变为Unicorn确实略微增加了详细程度,但仅限于web worker请求.我仍然无法下拉数据库请求等等.
通过heroku"drain"机制最大化日志详细程度的最佳方法是什么,以便可以将所有实例日志拉入一个内聚日志?
(理想情况下,我想包含一种方法将其转储到我自己的一个日志服务器中,因为这只是一种痛苦,后方无法及时查看特定事件和周围条件.)
yll*_*ate 12
在staging.rb,production.rb或您正在运行的任何环境中,您可以插入以下内容:
STDOUT.sync = true
logger = Logger.new(STDOUT)
logger.level = 0 # Must be numeric here - 0 :debug, 1 :info, 2 :warn, 3 :error, and 4 :fatal
# NOTE: with 0 you're going to get all DB calls, etc.
Rails.logger = Rails.application.config.logger = logger
### NOTE: Be sure to comment out these:
# See everything in the log (default is :info)
# config.log_level = :debug # Commented out as per Chris' instructions from Heroku
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4303 次 |
最近记录: |