Most server programs will perform some kind of logging to record their interactions with users and other systems. With logging frameworks such as the one built into the JDK, logging is so convenient and efficient that it is easy for the use of log files to become an essential part of the deployed software, used in billing or user tracking, for example. This 'scope-creep' is alright as long as it is documented and above all, tested.
In this chapter we will look at techniques for testing what is logged by our software. We will also show that it is possible to check what is being printed to the console by our programs.
The examples that follow are built around the logging package,
java.util.logging, built into the JDK, but would ...