In this section we will discuss what to log and the various levels at which we can generate log statements. Even though I have mentioned that we should generate log statements when control enters and exits a method, this is a rather controversial point. Especially generating log statements on exiting; because a method could have multiple exit routes. What do you think? I would say, if in doubt - do NOT generate logs when exiting a method. Logs that show control has entered a method do have value in my personal opinion, however you can leave those out as well if you do not see much value in them. Let me first draw your attention to the output from last page. 0 [main] DEBUG LoggerTest - Entering main 453 [main] DEBUG LoggerTest - Exiting main What is DEBUG? As I have explained, we should log several events from our program as it executes. But all events are not equally important. Hence, Log4J supports six levels for logging, where each level is appropriate for a...
Write Awesome User Manuals and Tutorials for Software Products