extracting error information from rails log files

时间:2021-04-18 07:15:40

i am developing on 5 different rails projects, plus also refactoring some (moving from older rails versions to 2.3) - what is the best way to extract the error information from the logfiles, so i can see all the depreciation warnings, runtime errors and so on, so i can work on improving the codebase?

我正在开发5个不同的rails项目,还要重构一些(从旧的rails版本迁移到2.3) - 从日志文件中提取错误信息的最佳方法是什么,所以我可以看到所有的折旧警告,运行时错误等等在,所以我可以努力改善代码库?

are there any services or libraries out there you can recommend, that actually help with rails logfile parsing?

你可以推荐哪些服务或库,实际上有助于rails logfile解析?

3 个解决方案

#1


7  

Read about grep linux command.

阅读grep linux命令。

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.

我不知道Rails中的错误日志格式是什么,但我的每一行都有警告或错误包含“警告”或“错误”字样。

Then it would be like this:

那就是这样的:

grep -E "error|warning" logfile.txt

grep -E“error | warning”logfile.txt

for bot error and warnings

用于机器人错误和警告

grep "error" logfile.txt

grep“error”logfile.txt

for errors

grep "warning" logfile.txt

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 -E“错误|警告”

tail -f logfile.txt | grep "error"

tail -f logfile.txt | grep“错误”

tail -f logfile.txt | grep "warning"

tail -f logfile.txt | grep“警告”

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

希望我可以帮助你;)我希望我对Rails中的日志格式没有错

#2


3  

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

我发现request-log-analyzer项目非常有用。

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.

您可以确定grep日志以查找错误并将其转储出来,但这样做可以很好地收集有关不同操作的所有信息以及它们需要多长时间。

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.

Hoptoad和/或Exceptional非常适合持续出现的错误,但它们不跟踪日志运行请求。 New Relic之类的东西对此有好处。

#3


1  

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.

我使用hoptoadapp,http://www.hoptoadapp.com/pages/home有一个免费的味道,它将您的错误消息记录到他们的数据库,它们提供了一个易于使用的界面。您所要做的就是安装此插件: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.

它对过去的错误没有帮助,但它非常适合隔离当前正在运行的应用程序的问题。

#1


7  

Read about grep linux command.

阅读grep linux命令。

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.

我不知道Rails中的错误日志格式是什么,但我的每一行都有警告或错误包含“警告”或“错误”字样。

Then it would be like this:

那就是这样的:

grep -E "error|warning" logfile.txt

grep -E“error | warning”logfile.txt

for bot error and warnings

用于机器人错误和警告

grep "error" logfile.txt

grep“error”logfile.txt

for errors

grep "warning" logfile.txt

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 -E“错误|警告”

tail -f logfile.txt | grep "error"

tail -f logfile.txt | grep“错误”

tail -f logfile.txt | grep "warning"

tail -f logfile.txt | grep“警告”

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

希望我可以帮助你;)我希望我对Rails中的日志格式没有错

#2


3  

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

我发现request-log-analyzer项目非常有用。

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.

您可以确定grep日志以查找错误并将其转储出来,但这样做可以很好地收集有关不同操作的所有信息以及它们需要多长时间。

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.

Hoptoad和/或Exceptional非常适合持续出现的错误,但它们不跟踪日志运行请求。 New Relic之类的东西对此有好处。

#3


1  

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.

我使用hoptoadapp,http://www.hoptoadapp.com/pages/home有一个免费的味道,它将您的错误消息记录到他们的数据库,它们提供了一个易于使用的界面。您所要做的就是安装此插件: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.

它对过去的错误没有帮助,但它非常适合隔离当前正在运行的应用程序的问题。