Can I get Heroku Logs to return only lines outlining errors?

前端 未结 7 2570
眼角桃花
眼角桃花 2021-02-19 03:33

The heroku logs are a great resource to check what happened to your app when things go wrong.. Unfortunately, they also log a great deal of information. Is there some way I can

相关标签:
7条回答
  • 2021-02-19 03:43

    Don't forget the --app flag. e.g.

    heroku logs --app my-live-app | grep -i error

    What I found helpful was the -d parameter: setting the type of log e.g. -d web Good when you have workers running tasks in the background and you just want to see whats going on with Web.

    Otherwise what @leonardoborges said I'd agree with. NewRelic or similar can work well.

    0 讨论(0)
  • 2021-02-19 03:52

    Personally I think that logs aren't the best place to look as the error and the detail are easily missed. I would ensure that my code was raising errors to an external location to ensure that they don't get missed.

    There's a number of options ranging from the simple ExceptionNotifier, to more advanced systems such as Airbrake (which is what I use myself).

    Not only will these notify you of the errors, but they'll also given you a stack of meta information that you can use.

    0 讨论(0)
  • 2021-02-19 03:55

    for checking all the logs in heroku console

    config.logger = Logger.new(STDOUT) config.logger.level = Logger::DEBUG

    put these two lines inside the environment on which you are running your heroku app(e.g. production.rb)

    You can check detail logs there also errors too if any.

    0 讨论(0)
  • 2021-02-19 04:00
    heroku logs | grep -i error
    

    You can also install the New Relic add-on, which reports detailed error traces. I've heard good things about Loggly, too.

    See also heroku - how to see all the logs

    0 讨论(0)
  • 2021-02-19 04:01

    Try this:

    heroku logs -t | grep 'error'
    

    To get a running list of errors as and when they occur.

    The inverted commas around 'error' did it for me.

    0 讨论(0)
  • 2021-02-19 04:05

    We manage a high traffic website hosted on Heroku and he combination of NewRelic and Airbrake is such a big #win.

    Have you tried these? Totally worth it and Heroku makes it dead easy to integrate them in your app.

    0 讨论(0)
提交回复
热议问题