Logging is a commonly underestimated resource in program
development. The more complex a program is, the harder it is to
locate the source of a problem. Using a debugger helps, but it
requires knowledge of the problem area to some extent. Through
application of a good logging concept and the use of supporting
tools it is often possible to locate trouble spots so well that a
debugger is no longer necessary.
Traditional logging a la println , even if it is
removable through a DEBUG flag, soon causes trouble
due to the following shortcomings:
-
No uniform concept for the structure of messages. Without
knowing the source and some measure of importance of a message,
coherence is lost. With problems caused by multithreading it
gets even worse.
-
No fine grained control over message generation. Often Logging
can only be turned on or off as a whole at compile time. When it
is turned on, some critical mass is soon reached where
performance suffers and the sheer mass of output becomes
unmanageable. As a consequence, logging statements which might
have been of use again are removed or commented out.
-
Missing tool support. For someone who has to wade through a
flood of log messages in a simple text editor the chances of
finding anything of value are minimal.
The de.qfs.lib.log and de.qfs.lib.logrmi packages address these problems by:
-
Separating messages into five levels of importance ranging
from error through warning and
message to method call and debugging.
Each of these has a sublevel for details.
-
Providing information about the time, active thread and calling
class and method for each message.
-
Controlling generation and dispatch of log messages through
multiple filter systems. This reduces performance penalties and
increases manageability.
-
Close cooperation with the log server qflog which makes use of
these features to provide visualization, sorting and filtering
of log messages. It also offers fine grained control over the
generation of messages at runtime.
Since the de.qfs.lib.log package is independent of all other qflib
packages, it can be separated into its own jar
archive if necessary. It also doesn't make any use of the
collection classes, so there is no need to provide the
collections.jar archive for JDK 1.1 applets that
use only the de.qfs.lib.log package.
|