The Logging interface
The Woof! environment provides a facility for logging messages
through the log
object.
The location of the log file is dependent on the web server
interface in use. In most cases, Woof! own logging facility is used
in which case the configuration variable
log_dir
specifies the directory in which the logs will
be stored. By default, this is the
temp directory under the Woof!
root. Note that Woof! itself does not currently rotate logs.
The name of the log file is specified by the
variable log_file
which is set to
woof.log by default.
Log messages have one of the following levels associated
with them: debug
, info
, notice
,
warn
, err
, crit
, alert
and emerg
. These levels are the same as those used by
the syslog facility on Unix.
Messages to the log file can be logged
at one of these levels using the corresponding method of the same
name. The message will be written to the log file only if the
current logging level is lower or equal to the log level of the
message. The current logging level is initialized to the value of
the configuration variable log_level
(info
by default) and can be changed through the
setlevel method.
The write method can be used to write a message to the log file at any level irrespective of the current logging level. For example,
log setlevel info log err "This message will not be written since err < info" log write err "This message will be written always."