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.


Useful Indeed.
This is good one. If the application is a web application, a ServletContextListener instantiating this class will do the job.