10) APyaX Logging Services

To help debug and audit APyaX, a logging service is provided which wraps parts of the Python logging module.

Logging can be performed to a global log file or to a session-specific log file. Call getLog() function on either the apyax object or the apyax session object to obtain an APyaX log object.

class apyax
Server side object to provide APyaX services
method getLog
def getLog(self)

Gets the logger object

Return Value
an APyaX logging object which provides services for logging (logging is discussed further in section 10).

class apyax_session
Provide APyaX session-specific services
method getLog
def getLog(self,key='')

Gets the logger object

Return Value
an APyaX logging object specific to this session which provides services for logging (logging is discussed further in section 10).

10.1) Logging Methods

class apyax_log
Wrapper class providing access to python logging
method getLogger
def getLogger(self)
get a Python logger object

the logger object can be used to send messages to the log. Logger objects are described in the python documentation on the logging module ( http://docs.python.org/lib/module-logging.html), but most commonly, the methods critical(msg), error(msg), warning(msg), info(msg) and debug(msg) are used to log a message described by the string msg of the appropriate severity:

Sun, 15 Jul 2007 21:06:18 WARNING  requested file not found

Return Value
python logger object
method getContents
def getContents(self)
get the log contents

Return Value
a string containing the contents of the entire log file

10.2) Configuring Logging

The APyaX configuration file has the following options for controlling logging:

log_level

Configures a filter allowing the verbosity of the logging to be adjusted. The allowable values for this option are: critical, error, warning, info, debug and notset.

log_directory

Sets the directory into which log files are written. The global log file is named apyax.log. Session-level log files are named <session-id>.log.


[apyax]

log_directory=/tmp
log_level=info

[TEST1]

log_directory=/tmp/apyax_test1_logs
log_level=warning

Configuring logging for both the global log and for TEST1 session logs.