23 April 2007

Use a $%*& SocketAppender

Pretty much everyone uses Log4J, hopefully through a facade layer like Commons-logging or JDK1.4 Logging. However, almost no one I know uses the SocketAppender.

Everyone has to establish a balance between using the debugger and writing log() statements. It's annoying to leave behind logging that was relevant only in the context of fixing a bug, but also bad to have no data on production issues because your debugger was your only source of diagnostics while you coded.

So, assuming you have some log statements, you ought to be able to watch them on one screen (you have several, right?) while you navigate through your app on the other. And, when there's a stack trace, the log entry should still only occupy one line on your log viewer, and you can summon a nicely formatted stack trace for that line when you like.

Too many developers are ignoring logs (how many times do I have to answer your question with "did you check the log?") and about as many are eye-parsing through log files. Use Chainsaw or Lumbermill already!

It's pretty easy to do:
<appender name="lumbermill" class="org.apache.log4j.net.SocketAppender">
<param name="RemoteHost" value="localhost">
<param name="Port" value="4445">
</appender>

Also, why is no one maintaining the log viewers? I tried to take over Lumbermill, which hasn't been active for 1.5 years but I thought I saw Robert Bushman claims he's still working on it.

1 comment:

Brad said...

What does the license look like? Can we just fork the project?