Amanda-2.6.1

Amanda::Debug


NAME

Amanda::Debug - support for debugging Amanda applications


SYNOPSIS

  use Amanda::Util qw( :constants );
  Amanda::Util::setup_application("amcooltool", "server", $CONTEXT_CMDLINE);
  debug("this is a debug message");
  die("Unable to frobnicate the ergonator");

See debug.h for a more in-depth description of the logging functionality of this module.


API STATUS

Stable


DEBUG LOGGING

Several debug logging functions, each taking a single string, are available:

error - also aborts the program to produce a core dump
critical - exits the program with $error_exit_status
warning
message
info
debug

Perl's built-in die and warn functions are patched to call critical and warning, respectively.

All of the debug logging functions are available via the export tag :logging.


ADVANCED USAGE

Most applications should use the Amanda::Util manpage's setup_application to initialize the debug libraries. The initialization functions available from this module are thus considered ``advanced'', and the reader is advised to consult the C header, debug.h, for details.

Briefly, the functions dbopen and dbrename are used to open a debug file whose pathname includes all of the relevant information. dbclose and dbreopen are used to close that debug file before transferring control to another process.

The variable $erroutput_type can take on any combination of the flags $ERROUTPUT_INTERACTIVE, $ERROUTPUT_SYSLOG and $ERROUTPUT_AMANDALOG. $ERROUTPUT_INTERACTIVE causes messages from error and critical to be sent to stderr. $ERROUTPUT_SYSLOG sends it to syslog, and $ERROUTPUT_AMANDALOG sends it to the current trace log (see the Amanda::Logfile manpage).

$error_exit_status is the exit status with which critical will exit.

All of the initialization functions and variables are available via the export tag :init.

The current debug file's integer file descriptor (not a Perl filehandle) is available from dbfd(). Likewise, dbfn() returns the filename of the current debug file.

debug_dup_stderr_to_debug() redirects, at the file-descriptor level, STDERR into the debug file. This is useful when running external applications which may produce error output.


ABOUT THIS PAGE

This page was automatically generated Fri Feb 5 19:41:21 2010 from the Amanda source tree, and documents the most recent development version of Amanda. For documentation specific to the version of Amanda on your system, use the 'perldoc' command.


Amanda-2.6.1