如何增加 Heroku 日志流失详细信息以包含所有 Rails 应用程序详细信息? [英] How to increase Heroku log drain verbosity to include all Rails app details?

查看:37
本文介绍了如何增加 Heroku 日志流失详细信息以包含所有 Rails 应用程序详细信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在 Heroku Celadon Cedar 上运行 Rails 3.1.x 应用程序,似乎非常缺乏日志详细信息.我已将日志级别设置为 DEBUG a la heroku config:add LOG_LEVEL=DEBUG --app app_name,这符合他们的建议,但除此之外我似乎无法拉入 log/* 文件内容.

Presently I'm running a Rails 3.1.x app atop Heroku Celadon Cedar and it seems that log verbosity is very much lacking. I have set the log level to DEBUG a la heroku config:add LOG_LEVEL=DEBUG --app app_name, which matched up to their recommendation, however beyond that I cannot seem to pull in the log/* file contents.

从 Thin 更改为 Unicorn 确实会略微增加冗长,但仅限于 Web Worker 请求.我仍然无法拉下数据库请求等等.

Changing from Thin to Unicorn did increase verbosity slightly, but only in web worker requests. I still cannot pull down the db requests and so forth.

通过heroku排水"机制最大化日志详细程度以便可以将所有实例日志拉入一个有凝聚力的日志的最佳方法是什么?

What is the best way to maximize log verbosity via the heroku "drain" mechanism so that one can pull all instance logs into one cohesive log?

(理想情况下,我想包含一种将其转储到我自己的日志服务器中的方法,因为这只是后部无法及时查看特定事件和周围条件的痛苦.)

(Ideally I'd like to include a method to dump this into one of my own log servers as this is just a pain the rear not being able to readily look at specific events and surrounding conditions in time.)

推荐答案

在 staging.rb、production.rb 或任何您正在运行的环境中,您可以插入以下内容:

In staging.rb, production.rb or whatever environment you're running, you can insert the following:

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

这篇关于如何增加 Heroku 日志流失详细信息以包含所有 Rails 应用程序详细信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆