extracting error information from rails log files

z3cko picture z3cko · Jan 16, 2010 · Viewed 11k times · Source

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?

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

Answer

kjagiello picture kjagiello · Jan 16, 2010

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