Link Details

Link 109998 thumbnail
User 329769 avatar

By alan_125
via jnassef.blogspot.com
Published: Sep 04 2008 / 23:43

All of us know that decoupling your code from the frameworks you use is a really great thing. Just imagine how much code you will be changing if you are using log4j APIs in all of you application classes, and then a decision was made to start using the java APIs instead. Think of how much code would be changed. But with commons logging, the code changes would be minimal. This must mean that commons logging is a good thing, right? WRONG!
  • 19
  • 9
  • 1683
  • 677

Comments

Add your comment
User 211643 avatar

zynasis replied ago:

0 votes Vote down Vote up Reply

shameless SLF4J promotion

User 329769 avatar

alan_125 replied ago:

0 votes Vote down Vote up Reply

Actually this wasn't my point. I was trying to show the negative points of JCL that are not there in SLF4J. SLF4J has its share of negative points as well (not using Java 5 varargs for parametrized logging, internationalization and using resource bundles are a few). The thing I wanted to stress on is the problems with the class loading, with its bugs and performance overhead.

User 241154 avatar

hammingweight replied ago:

0 votes Vote down Vote up Reply

This is a distinctly negative post; I would have preferred the emphasis to be pro-slf4j rather than this anti commons-logging rant.

User 329769 avatar

alan_125 replied ago:

0 votes Vote down Vote up Reply

I agree, but as I mentioned in my previous reply, the idea was discussing the problems with JCL's class loading, not how great SLF4J is.

User 326049 avatar

Stefan Fussenegger replied ago:

0 votes Vote down Vote up Reply

way too much words to make a simple point

User 329769 avatar

alan_125 replied ago:

0 votes Vote down Vote up Reply

This is one of my worst features. I'll try to be less talkative :)

User 61474 avatar

William Louth replied ago:

-3 votes Vote down Vote up Reply

This is like saying that a particular cigarette brand is bad for your health. Logging is bad for your health no matter what the brand. Just stop.

Lets have more events (CEP please) and dynamic state management and less stringified records.

User 329769 avatar

alan_125 replied ago:

0 votes Vote down Vote up Reply

I totally disagree with that. For small applications that are used for fun, you might be correct, but for large enterprise applications, this is totally wrong. For banking, brokerage, telecommunications, etc. logging is one of the most important aspects of any application.

User 187417 avatar

sproketboy replied ago:

3 votes Vote down Vote up Reply

SLF4J sucks for one simple reason. It's yet another wheel reinvention. Yes commons-logging sucks too which is why most people simply switched to log4j.

Sun should just stick javax in front of the log4j package and be done with it.

User 329769 avatar

alan_125 replied ago:

0 votes Vote down Vote up Reply

I agree that putting another layer in your application is bad for performance, but abstraction is important too. If you tie yourself to a specific framework, this is really bad. Log4J is a great framework, but I discovered that logback for instance has better performance (I'm going to publish benchmark results soon). If I want to switch from Log4J to Logback, it's going to be a real pain, and the time spent in the migration is going to be huge (and usually not worht it). I wrote an article on abstraction. It's quiet long (I can't control myself typing), but I hope its worth your time. You can find it here: http://www.dzone.com/links/bubble_wrap_hani_suleiman_and_logging_abstraction.html.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.