[Webfunds-devel] errors and diags -- how to deal with them
Ian Grigg
iang@systemics.com
Thu, 12 Apr 2001 22:11:26 -0400 (AST)
We are in dire need of an errors & diagnostics logging strategy
for WebFunds.
At the moment we have a bit of kludge, based on PrintWriters that
are opened on System.err. That has the advantage that it is easy
to understand, and any rampant System.err.print()s are captured
in the same place.
But, it's an awful kludge, and right now, I have to implement a
bridge between it and a more formal Log system that Intertrader
has implemented.
As PrintWriter is a huge class, I can't see quite how to do it
efficiently (by the normal technique of extending PrintWriter and
capturing all the method calls and converting them to calls to
an internal Log).
It would be as much work to rewrite all the uses of PrintWriter
within WebFunds to use something more sensible as it would be to
implement a comprehensive redirecting class extending PrintWriter.
But to what? Is there any accepted regime for collecting errors
and diags within Java? A sort of syslog for Java is what I'm
after here, some sort of framework we can just conform to.
Ideally, an errors and diags system should have these properties:
* each call identifies a level of severity, e.g., from 1 to 9.
* each call identifies the location of call, i.e., module,
package, line number
* each call must flush immediately to whatever backing store
is implemented (network or disk)
* contents of a call would include the following:
string,
exception,
stack trace,
time of call,
location of call (module, package, line number)
with varying degrees of optionality.
* output should be in a parsable format, allowing the various
tags (locations, times, traces, exceptions, etc) to be parsed.
* Notwithstanding above, output should be textual so as to
be usable with any text editor.
* multiline outputs would be nice.
Any suggestions? Now seems a suitable time to at least figure
out what would be a good system to aim for, even if we don't get
it done for my current project. We are entering a phase of usage
for WebFunds where there are half a dozen different projects
all working to build on top of the code base, all with varying
requirements, but all needing a consistent and flexible interface.
iang
PS: since writing this I've implemented a new Log class, see the
source for info. It seems to work, but it's a stop gap measure,
just extends from PrintWriter, and gives us a migration path to
something better.