users@glassfish.java.net

Re: Commons Logging and Log4J

From: Ryan de Laplante <ryan_at_ijws.com>
Date: Fri, 22 Aug 2008 09:47:01 -0400

> The current project (originally developed on JBoss) I'm working on has the necessity to stick with Log4J (Political decision).
I am interested in finding out the reasons why people choose to NOT use
the JDK's built in logger. I choose to not introduce dependencies in my
applications if I don't have to, so in the case of a logger I choose JDK
logger. I can think of some reasons why people might choose to not use
JDK logger:

- You can tell it to archive x copies of the log file after they reach y
KB in size, but you can't tell it to archive the log file daily
regardless of size unless you write your own appender. I think log4j
comes pre-packaged with this ability.

- The API to write a log message that contains an exception is a bit
easier in log4j because you don't need to specify the log level as a
parameter. You just use the appropriate method signature for the log
level that supports passing in an exception.

- There are some tools for analyzing log files such as Chainsaw that
support log4j log files but not JDK logger log files (at least I don't
think it supports JDK logger's format).

- You have experience with log4j and don't like change.

- You use something like Spring that comes with a logger and instead of
introducing yet another dependency, you just use whatever Spring uses.


Those reasons (except the last one) aren't convincing enough for me to
switch away from JDK logger. Can someone please enlighten me on the
political and technical reasons people still choose to NOT use the JDK
logger?


Thanks,
Ryan