Java logging

Tags: java, programming, rant,

Added: 2011-10-08T12:54:40

Java logging

Other people have posted about the crazy situation of logging frameworks in Java.

So, Java has a "built in" logging system called java.util.logging (JUL).
But everyone seems to have been using Log4J.
There are aspects I like from JUL (log.entering/exiting, more logging levels), and aspects I like of Log4J (format customisation).
There is something called JCL, and then there are all the apache-commons-logging things.

The solution? Write some crazy mess of things that allows you to swap between logging systems. I defy any normal human being to understand that lot.

Who on earth cares about swapping out logging systems?

I think that people sometimes lose trace of what they're doing, and where they are. They get caught up in their own little Java logging world, extending things, abstracting them, making them more complicated.
Honestly, all a logging system needs to do is log things to various files, in various formats, and possibly send emails.
I don't even really understand why you need Appenders, Handlers, etc.
log.fine(...) goes to this file. goes to this, etc etc.

Why is it so hard, and why do so many people seem to think that Yet Another Logging Framework is the answer?

So I'm going to write Yet Another Logging Framework, which will take all the best bits from them all, simplify them, and be excellent. I'll write a logging facade which will autodetect what you want to do, and enable you to slowly migrate, and never quite understand what's happening.
Oh, and it'll only show any output to tell you what's going wrong if you configure it correctly.
How about that?

On a serious note, I'd like to know if there are any libraries/systems that could generate Unit tests when Exceptions are caught. Something like:

String foo = null;
try {
    int i = service.countLetters(foo);
} catch ( Exception e ) {
where that would spit out a ready-made Unit test into my tests directory.

posted by Calum on 2011-10-08T13:00 under

Add a comment

Your IP:
Please enter 3072128 here: