Writing

Software, technology, sysadmin war stories, and more. Feed
Wednesday, May 9, 2012

The misery of horrible chat log handlers

The fun never seems to end when it comes to chat software.

The other day, I discovered that Adium has serious issues with handling its own log files. Here's what happened to me. See if it seems familiar to you.

You talk to someone about something. Some days pass. Then you think "oh, wow, I should look in that log because I need some data". Fortunately, you remember both who you talked to and at least one of the meaningful terms which should give you a nice close hit in your log.

You go off to your conversation log viewer, click on that contact, type in the word, and ... nothing. Pretty soon, you're doubting your own recollections. Did you even have this conversation? Maybe you had it with someone else? Or maybe you didn't use that exact word?

So you dig and you dig. You start searching *all* chat logs from all contacts instead of just the one. You search more and more days instead of just the past week. Soon, you're performing an immense operation which takes forever, and still you get nothing.

Frustrated, you decide to brute-force it. It might not be able to search things, but you sure can. You just have to read through the last few days of logs and...

Hey, wait a minute. There are tons of logs missing! Doing a search for some syntactic filler word like "the" should turn up every single log in there, but instead there are bunches missing. Okay, clearly this thing is insane.

I just love how you can type in a search term and get nothing, but then wait, right-arrow in that same field, hit ENTER, and then it will work. When is searching for "foo" not equal to searching for "foo"? When you've only done it once, apparently!

It gets better. If you decide to take the "Unix hippie" way out and go digging for your logs on disk, you will find that they are in fact out there. You have to start in your home directory, then Library, then Application Support, then Adium 2.0, Users, Default, Logs, and then Jabber.username@domainname. In there, you'll see a bunch of chat contacts.

Incidentally, those embedded @s will probably trip up your shell's tab completion, so get used to typing "\@" to spur it onward. Fun!

Only now can you cd into the right directory for your contact and then finally into the directory for a given log. Yes, there is a directory of the format "account (time).chatlog" containing just one file named "account (time).xml".

And thus we get to the final little steaming present. As the file extension suggests, it is in fact XML. Upon opening it for reading, this is what you see:

<message sender="user@example.com" time="2012-05-04T22:09:13-07:00" alias="Contact Name"><div>actual message</div></message>
<message sender="user@example.com" time="2012-05-04T22:09:17-07:00" alias="Contact Name"><div>something else</div></message>
<message sender="user@example.com" time="2012-05-04T22:10:01-07:00" alias="Contact Name"><div>third line</div></message>

... and so on. Try reading *that* without losing your mind.

It's a combination of log files clearly not meant for human consumption and an indexing system which can display them, but often can't find them. It's absolutely brilliant!