Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j vs J2SE1.4 log

 
K Huang
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just started learning log. In Jakarta common logging, u can choose which logging to use.
log4j is very popular, but java 1.4 has log too. I am wondering log4j has no future.
What is your opinion ?
 
Mike Farnham
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim,
The apache commons project allows you a choice. So, you can use a single API for your logging.

I believe there is a strong base of log4j users since it was established before the JDK 1.4 Logging API. I know one of our developers indicated he thought log4j was better.

I would think it will mostly depend on your needs to use the standard consultant answer.

You might check out the book:
"Logging in Java with the JDK 1.4 Logging API and Apache log4j" by Samudra Gupta.

Cheers,
Mike
 
Brian Sam-Bodden
author
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my opinion Log4J is a much more mature logging implementation proven in countless applications, both J2SE and J2EE applications. As with anything created by committe I think the J2SE logging lacks a lot of the features that appear in an API from extensive usage in heterogenous environments. I personally use Commons Logging usually fronting Log4J. For J2SE apps I sometimes use the J2SE logging but never for J2EE applications.

Brian
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.ingrid.org/jajakarta/log4j/jakarta-log4j-1.1.3/docs/critique.html
 
K Huang
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all your reply !
No wonder log4j is still so popular even though 1.4 has log too.
 
Scott Duncan
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the 1.4 implementation to be decent but limited when compared to log4j. Plus, although it's been a while, I thought it was hard to find decent documentation but that may have changed by now. My organization has quite a few apps that use commons logging and/or log4j. Both, in my opinion are better that the current Sun implementation.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would be perfectly satisfied with JDK Logging API if only they had included a facility similar to Log4J's DailyRollingFileAppender. I can't believe they didn't include a date-based rolling file appender even though they did include a file size-based one. Sigh.
 
Christopher Judd
author
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have done performance tests between the two and determined Log4j was about 10% faster then J2SE Logging.

I always front logging with commons logging but I especially like to do it with J2SE because fine, finer finest is to ambiguous.
 
K Huang
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all your reply !
How do u guys learn log4j before any book is available ? Just by Apache on line documents ? I tried Apache on line documents for Struts, Commons(Pool, DBCP) before. I have to say I am not smart enough to learn well by those free document.
This new book is an overall introduction, not for learning a specific technologies. I am wondering if I can read this book for a general idea and learn each specific item by on-line document ?
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Christopher Judd:
I have done performance tests between the two and determined Log4j was about 10% faster then J2SE Logging.

I always front logging with commons logging but I especially like to do it with J2SE because fine, finer finest is to ambiguous.


How to testing performance between J2SDK Logging API and Log4j ?
 
Christopher Judd
author
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recommend you start with the article Building Flexible Logs With log4j by Vikram Goyal
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm study log4j from document on line base on Apache website and another website such as forum at http://www.javaranch.com, http://www.onjava.com ... etc.

And i'm read some book about Log4j, you can see more book at amazon.com.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic