Can I get Heroku Logs to return only lines outlini

2020-07-02 10:54发布

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 filter the logs just for error messages?

6条回答
爷的心禁止访问
2楼-- · 2020-07-02 11:20
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

查看更多
▲ chillily
3楼-- · 2020-07-02 11:24

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.

查看更多
三岁会撩人
4楼-- · 2020-07-02 11:26

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.

查看更多
Root(大扎)
5楼-- · 2020-07-02 11:33

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.

查看更多
ゆ 、 Hurt°
6楼-- · 2020-07-02 11:34

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.

查看更多
虎瘦雄心在
7楼-- · 2020-07-02 11:45

Take a look at some of the logging addons - I use PaperTrail with much success but the others like Loggly and Progstr Logging will offer similar services.

Essentially you drain your logs into their services and they provide the ability to perform realtime searches against your logs and then you can handle it - most will offer some kind of notification either via campfire, email, text message or a simple HTTP post into some other application to handle the error message.

查看更多
登录 后发表回答