NAME
ROADS::ErrorLogging - A class to log errors and optionally bomb out
SYNOPSIS
use ROADS::ErrorLogging;
WriteToAdminLog("$0", "something weird is #;:<>!%&*");
WriteToErrorLog("$0", "Uh oh... :-(");
WriteToErrorLogAndDie("$0", "time for tubby byebye: $!");
DESCRIPTION
This class defines three methods which may be used to log messages and program names to log files. Log file entries are written after the fashion of the common HTTP error logging style, and the log files are locked while active to avoid corruption when multiple processes attempt to write to the same file at the same time.
METHODS
WriteToAdminLog( progname, message );
This method writes message to the admin log, stamped as being from the program progname.
WriteToErrorLog( progname, message );
This method writes message to the error log, stamped as being from the program progname.
WriteToErrorLogAndDie( progname, message );
This method writes message to the error log, stamped as being from the program progname, and then kills itself off. It adds the tag '(FATAL)' to the message, and if the environmental variable GATEWAY_INTERFACE isn't set, also sends the program name and message to STDERR.
FILES
logs/admin - where admin logs are written to.
logs/errors - where error logs are written to.
FILE FORMAT
Both the admin and error log files are structured as follows :-
- the date, prettyprinted in UTC (GMT)
- the name of the program which is sending the message
- the message itself
BUGS
We should make it possible to specify alternative log files. The code actually understands the ROADS::Logs variable, but the actual log file name is hard coded in at the moment. It probably ought also to be configurable whether we bomb out - which would potentially leave us with just a single logging routine instead of three almost identical ones!
SEE ALSO
Most of the ROADS tools!
COPYRIGHT
Copyright (c) 1988, Martin Hamilton <martinh@gnu.org> and Jon Knight <jon@net.lut.ac.uk>. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
It was developed by the Department of Computer Studies at Loughborough University of Technology, as part of the ROADS project. ROADS is funded under the UK Electronic Libraries Programme (eLib), the European Commission Telematics for Research Programme, and the TERENA development programme.
AUTHOR
Jon Knight <jon@net.lut.ac.uk>, Martin Hamilton <martinh@gnu.org>