java Logger vs. Log4J

S

Sideswipe

So, I was adding come code for a logger to my stuff and my editor
offered me a selection of loggers. Since this is my first time with
1.5 I was surprised to see that there was a built in logging mechanism
in Java5.

So, then it brought me to the question of which is better? I noticed
that log4j has many more logger output destinations than the sun one.
Which means out-of-the-box usage is fast. But, since it's part of the
JDK, SUNs logger has no dependencies

Sun was so late with a logging platform I fear they may have lost out
to log4j.

Any thoughts?

Christian Bongiorno
http://christian.bongiorno.org
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Sideswipe said:
So, I was adding come code for a logger to my stuff and my editor
offered me a selection of loggers. Since this is my first time with
1.5 I was surprised to see that there was a built in logging mechanism
in Java5.

So, then it brought me to the question of which is better? I noticed
that log4j has many more logger output destinations than the sun one.
Which means out-of-the-box usage is fast. But, since it's part of the
JDK, SUNs logger has no dependencies

Sun was so late with a logging platform I fear they may have lost out
to log4j.

Any thoughts?

I would use java.util.logging for a JSE desktop app. No need for
an extra jar and the logging requirements are probably not
that sophisticated.

I would use log4j for a JEE server app. The chances are >95% that
log4j will already be there. And performance and support for
weird logging destinations can be critical.

Arne
 
M

Mark Thornton

Sideswipe said:
Sun was so late with a logging platform I fear they may have lost out
to log4j.

No I think there are significant bodies of code using both platforms.
And of course there are then logging wrapper libraries that try to hide
both of them. So instead of having just one logging platform we have at
least three. Unfortunately neither log4j or java logging is a subset of
the other.
 
Z

Zsolt Koppany

We tried to move from log4j to sun's logging package (just to have one
package less) but figured out that log4j is much better.

Zsolt
 
K

Karl Uppiano

Zsolt Koppany said:
We tried to move from log4j to sun's logging package (just to have one
package less) but figured out that log4j is much better.

It seems to be a bit of a religious issue around my workplace. Fortunately,
it is relatively easy to switch between one and the other, the API is
similar. I tend to prefer the self-contained aspect of using JUL
(java.util.logging) as opposed to having to drag in a third party jar just
to do logging.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top