This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Dear all, We know that logging is very useful to help us in developing phase. We can know the defect or the success of our code. And we can choose one of logging mode we want ( FATAL, ERROR, WARNING, INFO or DEBUG).
Example for developing phase we choose DEBUG mode, and we have a lot of logging statements in our code. After our code is 'live', we still don't remove those statements and we choose FATAL mode. Will it impact to the overall performance of our application?
To me this is one area that the Java logging API falls down. You really need something external to determine if you should log or not.
The Jakarta Commons Logging api is a thin veneer over standard logging mechanisms (such as 1.4 logging or Log4J) and give you the flexibility to do something like:
The advantage is that you can turn debug logging on and off external to the program by modifying the config file.
The call to check if debug logging is enabled does give a tiny bit of overhead. But it is well worth it, in my mind, to allow you to turn on debugging when an application at the customer site is barfing. If you construct your logging correctly you can even create a debug log for a single class.
<a href="http://forums.hotjoe.com/forums/list.page" target="_blank" rel="nofollow">Java forums using Java software</a> - Come and help get them started.