oink日志命令在heroku上不起作用 [英] oink logs command not working on heroku

查看:96
本文介绍了oink日志命令在heroku上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在我的heroku应用程序上开始使用 oink gem ,因为我注意到某些控制器操作会导致少量内存泄漏. oink logs命令在本地可以正常运行,但我无法弄清楚该命令使其在我的生产站点上正常工作.

I recently started using the oink gem on my heroku app because I noticed a small memory leak with some controller actions. The oink logs command works fine locally but I can't figure out the command to get it to work on my production site.

这是我正在尝试的命令:

Here's the command I'm trying:

heroku run oink /log/*

这是我的production.rb文件中的行:

config.middleware.use( Oink::Middleware, :logger => Rails.logger )

在我的本地安装中,oink将日志存储在/log/oink.log文件中.

On my local installation, oink is storing the logs in the /log/oink.log file.

推荐答案

答案是: https://stackoverflow.com/a /14145299/1684322

使用Hodel3000CompliantLogger而不是Rails.logger很重要,否则oink将无法解析日志文件.也可以不在config/environments/production.rb中进行配置,例如在config/initializers/oink.rb

It is important to use Hodel3000CompliantLogger instead of Rails.logger otherwise oink will fail parsing logfiles. It may also be configured not in config/environments/production.rb but for example in config/initializers/oink.rb

YourApplication::Application.middleware.use( Oink::Middleware, :logger => Hodel3000CompliantLogger.new(STDOUT), :instruments => :memory)

这将使Oink写入默认日志文件,以后可能会捕获

This will make Oink write to default log file which may be later captured by

heroku logs -n500 --app app_name > logfile_for_oink

或使用其他日志管理工具(例如PaperTrail)或设置syslog消耗(另一个* nix框上的rsyslog).

Or use other log management tool like PaperTrail , or set up syslog drain (rsyslog on another *nix box).

使用oink和--threshold = 0来显示所有条目

Use oink with --threshold=0 to show all entries

这篇关于oink日志命令在heroku上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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