calyxofheld
calyxofheld

Reputation: 2168

how can i get Rails app logs to display in Heroku logentries add on?

At some point my app stopped showing useful app logs, and started showing router logs instead:

2020-06-10T04:57:59.800199+00:00 heroku[router]: at=info method=POST path="/users/sign_in" host=www.site.com request_id=265df286-81dd-409e-90d0-294c6bad5fdb fwd="108.81.21.74" dyno=web.1 connect=0ms service=181ms status=302 bytes=758 protocol=https
2020-06-10T04:57:59.941157+00:00 heroku[router]: at=info method=GET path="/onboard/username" host=www.site.com request_id=99a54c01-749a-44b3-885d-171260a07a1f fwd="108.81.21.74" dyno=web.1 connect=0ms service=49ms status=200 bytes=13478 protocol=https

These aren't very helpful. Is there a setting that I need to turn on?

Upvotes: 0

Views: 173

Answers (1)

calyxofheld
calyxofheld

Reputation: 2168

Not sure how it happened, as I haven't changed my environments file, but adding this to production.rb fixed it:

if ENV["RAILS_LOG_TO_STDOUT"].present?
 logger = ActiveSupport::Logger.new(STDOUT)
 logger.formatter = config.log_formatter
 config.logger = ActiveSupport::TaggedLogging.new(logger)
 config.log_level = :debug
end

Logs back to normal!

Upvotes: 0

Related Questions