Saturday, February 26, 2011

Best error message ever

A while back, I sent a text message and got this error back from AT&T.

Wow... thanks. I... didn't know you cared?

Apparently they just append the text of the message (this one was to my wife) to the end of the error, without saying "original message follows" or anything like that.

In case anyone wants to try getting their own amusing messages, I believe this happened because I mistakenly sent to a land line.

Wednesday, February 23, 2011

Watching your log for a specific value

If you use Unix, you probably know about piping one command's output through another. You may also know that
tail -f somefile
will show you whatever gets added to the end of a file in real time.

While working with Rails, I do
tail -f log/development.log
all the time to watch how Rails processes my page requests. Today, I was looking for a specific error message to show up - a MissingTemplate error that a user had experienced**, and I was trying to reproduce it.

Since I didn't care about anything that was being logged at that moment other than the error I was looking for, it occurred to me to do this:

tail -f log/development.log | grep 'MissingTemplate'

As I poked around our site, I saw nothing. Until I encountered the error, and BAM - that one line popped into my terminal. Error case located!

Just one more way that chaining simple tools together can be very powerful.

**Actually, the user didn't see the MissingTemplate error; they got a friendly error message, as they should. But we got an email from Hoptoad with the actual error.