Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBryan Guillen
1,051 PointsWe're sorry, but something went wrong?? ( Rails App )
Hey TeamTreeHouse,
I am new to ruby and also, Ruby On Rails. I am going through comprehensive twitter tutorials. However now, when I click a couple of links like 'forgot password' or 'signup' in app, I get "If you are the application owner check the logs for more information." as a message.
I checked out my Log File and it is so long and complex, especially to the untrained eye.
How can I use logs to see what is wrong with the app? What should I look for in logs?
Other than using logs, are there any other ways to find out "what went wrong"?
1 Answer
Brandon McClelland
4,645 PointsThe logs usually catch the Error messages as they happen. If you are tailing the logs as the store is being interacted with, sometimes you can see the Error messages being triggered. By tailing I mean running the "tail -f /location/to/rails/app/log/whichever.log" command in a separate terminal/console.
You can also run grep on the log file to look for error messages plus or minus a few lines.
grep -C 3 "keywords to search" /path/to/app/log/whichever.log
Or open the log file in Sublime or your text editor of choice and use Find to search for Error. Just searching for "Error" is far too generic, it helps if you have an idea of the type you're looking for, such as "ArgumentError".
When you work in Development mode the error message that gets logged is usually printed to the browser window by default. The most useful information is usually the first line as it'll point to particular file that triggered the error.
The best way to use the logs is to have written your own logging statements when you're testing a new class or module out. Then you know in advance what pattern to grep for.
Bryan Guillen
1,051 PointsBryan Guillen
1,051 Pointsawesome! Thanks Brandon. Since it was a simplistic sample app, I was able to use Error to find the errors in the log and scroll down systematically to check it out...
Thanks that helped out.