Log For Java

Officially known as Log4J, but that's not a WikiName. One of the Apache Organization open-source projects. Information at http://jakarta.apache.org/log4j/docs/index.html

From the site:

With log4j it is possible to enable logging at runtime without modifying the application binary. The log4j package is designed so that these statements can remain in shipped code without incurring a heavy performance cost. Logging behavior can be controlled by editing a configuration file, without touching the application binary.

There's also a new book about it, but Amazon doesn't seem to have it at ISBN 2970036908


The need to incorporate logging code in a webserver in the twenty-first century is, in my opinion, eloquent testimony to how bad our development tools are and to how empty our industry's claims of objectivity are. Tomcat ran inside VisualAgeJava nearly five years ago (in 1999), with full breakpoint and incremental source development capability. Our industry ignored it, adopting hacks like Log4j instead. I call it JobSecurityForProgrammers.


I agree, Tom, that at development time there are more powerful debugging alternatives than trace logging - even in Java! (with IntellijIdea we're finally back to a level of capability close to what we had in SmalltalkImplementations two decades ago). But I'm using LogForJava at production operations time, to write performance statistics, audit logs, and the like. I'm finding it helpful for that purpose. Best, RandyStafford


Production time logging via LogForJava is more output that could be checked with UnitTests. I can think of three ways to intercept and check the LogForJava output:

Remember to DoTheSimplestThingThatCouldPossiblyWork.

-- JoelShprentz


Now that Java 1.4 has its own Logging capability, is there any advantages/disadvantages using Log4J over Java's own logging?

It works with java 1.3 - we aren't upgrading yet.


For an equaivalent for CeePlusPlus see LogForCpp. Also of interest: LogForRuby.


CategoryJava CategoryLogging


EditText of this page (last edited February 16, 2009) or FindPage with title or text search