<< New Language Features Galore | Home | The New Bloglines Beta: Habit Breaking Changes >>

Log4j Must Die

Logging frameworks are the center of some discussions lately. See here and here.

Five years after the Java Logging API appeared in Java 1.4, and with the availability of the LumberJack implementation of the Java Logging API for prior versions of Java for just as long, I feel sad that Java people are still arguing about logging frameworks and the use of ill-conceived wrappers, and wrapper-wrappers.

Here's a simple truth that people who are still talking about logging frameworks are missing:

There is an adequate logging framework in the JDK for @#%*-ing five years.

Use it directly. Or, if you like wrappers, write a wrapper yourself. It can be done in less than a day. This is the path of least resistance.

Of course, if after careful consideration, the Java Logging API just isn't going to work for your project, then, yeah, go ahead and use whatever is out there that you like. You have my sympathy. But please keep the complaining to yourself.

Tags :


Re: Log4j Must Die

The problem (as I'm sure you know) is that logging is a common cross-cutting concern, thus app servers bundle their own versions of log4j, commons-logging, etc. And when you then try to deploy families of collaborating apps and libraries inside your own company, and some of these apps use different versions...or rely on third party tools that depend on certain versions of a logging library...you get weird classloader and classpath error messages. The logging built-in to the JDK is perfectly fine, and removes the need for yet another JAR in the classpath. One more thing: Your blog forgot my information despite the fact that I keep checking "Remember me".

Re: Log4j Must Die

We are switching everything back to log4j. I wasn't part of the decision, but I think the reasoning was to meld better with all the open source software we now rely on (which uses log4j).

Re: Log4j Must Die

Well good luck on that. Just don't rant about your logging being broken by some innocent looking cool third party open source package. You know what I'll say:

"See, I Told You So!"

Re: Log4j Must Die

I'm still sticking to log4j, because jdk logging is simply not cutting it for developers like me who rely on logging instead of running-the-whole-app-server-in-IDE-and-stepping-through-it for troubleshooting. Log4j's NDC, MDC, and some of the more flexible conf elements are extremely useful in that aspect.

From the system maintenance stand point, jdk logging isn't adequate at all. It doesn't support rolling log files by date. Without writing your own handler, you can't send logging to syslog or email - and those aren't just some weird requirements. Many support people (i.e. non-Java people) I have worked with link up their pagers to the production systems they are responsible for. And the ability to send a special category fatal message to an email address _transparently_to_the_app_ makes many people's lives easier.

For the same reasons, whenever we have a choice, we don't use wrappers because they are the least common denominators.

Re: Log4j Must Die

Better that JDK logging die. The fundamental problem isn't that people don't use it. That's a symptom. The problem is that Sun and friends concocted their own half-baked api instead of merely including the well proven de-facto standard, log4j, as they should have done.

JDK Logging Must Die

It's simply inadequate for my needs, without writing a lot of code to handle the edge cases I want. log4j works, out of the box, and can be easily filtered and piped into different log files or different services (email, pagers, databases, etc.) easily. The JDK logging is incomplete and irrelevant.

Add a comment Send a TrackBack