There are many times where it is useful or even necessary to peer inside a program and observe what it is doing. The most complete way to do this is with a debugger, such as the one included in Eclipse. This is not always a possible or practical solution for many reasons, not the least of which is that there is no way to run a production system in a debugger. Therefore, it must become the program’s task to report on its internal state. In the most general sense this task is called logging.
An obvious and much-used technique to log information is to liberally sprinkle
println() statements throughout a program. However, this approach quickly proves to be insufficient for many reasons.
Printing all log messages ignores the fact ...