September 2009
M T W T F S S
« Aug   Dec »
 123456
78910111213
14151617181920
21222324252627
282930  

Disclaimer

Opinions expressed here are entirely my own and do not reflect the position of my employer or any other entity.

The views and opinions expressed by visitors to this blog are theirs and do not necessarily reflect mine.

This work is licensed under a Creative Commons license.

Creative Commons License

I Hate System.out.println()

Java programmers love this deadly API – System.out.println(). It is easy to use and versatile. A definite improvement over the old printf() from my C Programming days.But I hate the damn thing. Hate it with a loathing that only someone who has spent days and weeks trying to get some other idiots code to work knows.

This innocuous Java statement prints a string to the standard console. It will print whatever you want it to. Which is great if you are the original programmer and knows how the program behaves in the first place. Now imagine a situation where your code is in production and you have left these nice statements in your code. A poor cove like myself is trying to see why your code is not behaving the way it is supposed to. All I have is a console that is printing gibberish at high speed while I stare at it. Even if I redirect the standard console to a file I cannot make sense of the mass of gobbledygook that does not have any threading or timestamp information.

Now for someone who religiously uses Log4J for even the simplest programs because he has learned the hard way that even one’s own code is so much mumbo jumbo after a few weeks of working on something else, this is the nearest thing to what the Christians call Hell, albeit on Earth.

So I put together a  simple class I call – SystemOutRedirectToLog4J.

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

2 comments to I Hate System.out.println()

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>