extracting error information from rails log files

半城伤御伤魂 提交于 2019-12-03 08:20:14

Read about grep linux command.

http://www.cyberciti.biz/faq/howto-use-grep-command-in-linux-unix/

I don't know what error log format is in Rails, but I guest every row with warning or error contain "warning" or "error" word.

Then it would be like this:

grep -E "error|warning" logfile.txt

for bot error and warnings

grep "error" logfile.txt

for errors

grep "warning" logfile.txt

for warnings

and if you want to see new errors and warnings in real time, try this

tail -f logfile.txt | grep -E "error|warning"

tail -f logfile.txt | grep "error"

tail -f logfile.txt | grep "warning"

Hope I could help you ;) and I hope that I'm not wrong about logs format in Rails

I've found the request-log-analyzer project to be very useful.

You can certain grep the log to find errors and dump them out, but this does an excellent job of gathering all the information about the different actions and how long they take.

Here's some sample output.

This is the first thing I run when I get a call saying "my site is slow and I need help fixing it."

Hoptoad and/or Exceptional are great for ongoing errors, but they don't track log running requests. Something like New Relic is good for that.

I use hoptoadapp, http://www.hoptoadapp.com/pages/home there is a free flavor, it logs your error messages to their database, and they provide an easy to use interface. All you have to do is install this plugin: http://github.com/thoughtbot/hoptoad_notifier.

It won't help for past errors, but it is great for isolating problems with a currently running app.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!