I am logging some errors by doing this in my Rails app:
logger.error "MY ERROR STRING"
How can I look in heroku logs to find that line?
I know how to do heroku logs --tail and heroku logs -n 500 ,but how can I find a specific string in the logs?
Using
heroku logs -t | grep "term"is great for filtering current log events. However, Heroku retains a max of 1500 lines of log output, so even if you doheroku logs -n 1500 -tyou won’t see log events that occurred prior to that log window.The better approach is to use a logging add-on like Papertrail that retains your logs for a greater period of time and makes your full log history searchable.
Of course, it also possible that the log event you think is triggering in your code isn’t.