Question

I have installed NewRelic on my Heroku app, but I would like to turn it off (or at least not see logs) when I run a rake task with heroku run rake xxx - it produces so much of its own output, that the results of rake tasks are obscured.

Wondering if there is some way to do this through the NewRelic config file, etc.

This question here suggests that it addresses the problem, but I'm fine leaving the New Relic settings as is for the app, just not for rake, console and other command line tasks where I might be expecting to read through my own "puts" output etc.

Was it helpful?

Solution

Edit your Rakefile in the root of your Rails app, and add the following:

ENV['NEW_RELIC_AGENT_ENABLED'] = 'false'

NewRelic agent will respect this environment variable, and setting it within the Rakefile will cause it to be set for all rake tasks, before your app or newrelic agent loads.

OTHER TIPS

Accurate property name is NEW_RELIC_AGENT_ENABLED. So you should put such line into your Rakefile:

ENV['NEW_RELIC_AGENT_ENABLED'] = 'false'

PS Thanks Winfield!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top