By: N.B. Harrison
Published in: PLoPD3
Category: Communications, Telecommunications, Transaction Processing
Summary: Transaction-oriented systems lend themselves to common approaches to logging diagnostic messages.
To report diagnostic information in a consistent manner, use a diagnostic logger as a single point for all messages to flow through. The diagnostic logger has two functions: (1) control of logging in general, e.g., specifying the output destination, error thresholds, debugging levels; and (2) other functions that allow the rest of the system to output diagnostic messages.
You're using Diagnostic Logger. If an error occurs in processing a set of discrete inputs, to associate error messages with the responsible input, while a transaction is processed, a diagnostic object identifies the transaction. The diagnostic logger will associate the error message with the context information in the associated diagnostic context.
You're using Diagnostic Context and logging many different messages (e.g., errors, warnings, debugging messages). To be sure they are handled consistently, create an inheritance hierarchy of diagnostic message types. Each type encapsulates the characteristics of that category of diagnostics and parameterizes the variations. Details of diagnostic messages are embedded in the classes.