Kei*_*cht 14 ruby-on-rails heroku unicorn ruby-on-rails-3 papertrail-app
我相信rails生产的默认行为是不输出所有部分的渲染.这应该登录开发而不是生产.
但是,我在制作中看到了这一点,我不知道如何删除它.我的日志太吵了.我的生产环境是Heroku运行Unicorn并使用Papertrail查看我的日志.我知道Unicorn用日志做了一些不稳定的东西,并且为了让它们正常工作,我必须将它添加到我的production.rb:
config.logger = Logger.new(STDOUT)
config.logger.level = Logger.const_get('INFO')
Run Code Online (Sandbox Code Playgroud)
(在此解释:http://help.papertrailapp.com/kb/configuration/unicorn)
但即使使用log_level INFO,我在所有日志中都看到了大量的这些:
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_caption.html.erb (0.7ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_rights.html.erb (2.1ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_category.html.erb (4.8ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_caption.html.erb (0.3ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_rights.html.erb (0.4ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_category.html.erb (4.4ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_caption.html.erb (0.3ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_rights.html.erb (0.3ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_category.html.erb (1.8ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_caption.html.erb (0.4ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_rights.html.erb (4.6ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_category.html.erb (2.1ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_caption.html.erb (0.3ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_rights.html.erb (0.4ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_category.html.erb (4.1ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_caption.html.erb (0.2ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_rights.html.erb (1.8ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_category.html.erb (6.0ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_caption.html.erb (0.5ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_rights.html.erb (0.8ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_category.html.erb (1.9ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_caption.html.erb (0.3ms)
Jun 25 22:15:15 tacktile app/web.1: Rendered photos/pieces/_rights.html.erb (0.7ms)
Run Code Online (Sandbox Code Playgroud)
Pat*_*non 23
对于Rails 4(至少):
在config/environments/development.rb中尝试这个
config.action_view.logger = nil
Run Code Online (Sandbox Code Playgroud)
我从纸质线索中得到以下答案:
我认为解决这个问题最快的方法是使用我们的日志过滤功能。这将让您删除与正则表达式匹配的任何内容,并使您不必进行任何应用程序配置更改。
从长远来看,您可能希望从源头消除这些消息。Lograge 可能是您最好的选择。您可能会发现它还删除了一些其他内容,但请尝试一下并让我知道您的想法。
我知道目前这可能与您无关,但为了将来的使用,您可能还会在这里找到一些其他有用的提示。它涵盖日志记录、删除静态资产请求和不必要的操作,
如果您需要上述任何帮助,请告诉我。
| 归档时间: |
|
| 查看次数: |
4788 次 |
| 最近记录: |