我已经在我的 Heroku 应用程序上安装了 NewRelic,但是当我使用 heroku run rake xxx 运行 rake 任务时,我想将它关闭(或者至少看不到日志)——它会产生很多自己的输出,以至于rake 任务的结果是模糊的。
想知道是否有一些方法可以通过 NewRelic 配置文件等来做到这一点
This question here suggests that it solves the problem,但我很好地保留应用程序的New Relic设置,只是不适用于rake、控制台和其他我可能希望自己阅读的命令行任务“放”输出等
最佳答案
在 Rails 应用程序的根目录中编辑 Rakefile
,并添加以下内容:
ENV['NEW_RELIC_AGENT_ENABLED'] = 'false'
NewRelic 代理将遵守此环境变量,并且在 Rakefile
中设置它会导致在您的应用程序或 newrelic 代理加载之前为所有 rake 任务设置它。
关于ruby-on-rails - 为 heroku run rake、heroku run console 等关闭 NewRelic,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21384766/