Logging

Logging consists of two parts. web::log issues a logging message, while web::logfilter and web::logdest determine where to send a message. Websh uses a two-step filtering. First, Websh determines whether it should handle a message, or not, using the filters configured with web::logfilter. Then, Websh determines which message is to be sent where, using the filters configured with web::logdest.

A filter consists of a tag and a level, separated by a ".". The tag is free text. Typically, it is the name of the application, say "foo". Example: "ws3.debug". Levels are, in order:

web::logdest

web::logdest subcommand ?options? level plugin

Subcommands are: add, delete, and names. Options are: -maxchar, and -format.

Known plug-ins are: file, syslog, command, channel, and apache. Note: the plugins may have indiviudal options (-unbuffered), see documentation below. The format string consits of format specifications for fprintf() plus: p (process id), t (thread id), n (log level), f (log type), and m (the message).

	  web::logdest add -maxchar 25 -format "%x %X \$l \$m" *.-debug command logTest

web::logfilter

web::logfilter subcommand args

Subcommands are: add, delete, and names.

Add a filter to the list.

web::logfilter add level
add a level to the list.
web::logfilter delete ?name?
remove a name from list, or remove all filters if name is omitted.
web::logfilter names
list all filters that have been set.

web::log

web::log level msg

Issue a log message. It is possible, should the user so desire, to have the web::log run subst on its arguments. This behaviour is turned off by default, and can be turned on by doing:

web::config logsubst 1

.

Log plug-ins

File

web::logdest add destination.-level file ?options? filename

Option is: -unbuffered

Syslog

web::logdest add *.-debug syslog ?level?

See the man page for syslog for levels on your system. Typical: 10.

Command

web::logdest add *.-debug command cmdName

Channel

web::logdest add *.-debug channel ?options? channel

Option is: -unbuffered

Apache

web::logdest add *.-debug apache

Available in mod_websh only.

Example 8. web::log

	    % web::logfilter add *.-debug
	    logfilter0
	    % web::logdest add *.-debug channel stdout
	    logdest0
	    % web::log info {Websh is cool}
	    03/01/00 00:00:00 [111] user.info: Websh is cool
	    % web::logdest delete logdest0
	    % web::logdest add -format "--> \$m\n" *.-debug channel stdout
	    logdest1
	    % web::log info {Websh is cool}
	    --> Websh is cool
	    % web::logdest delete logdest1
	    % web::logdest add -maxchar 5 *.-debug channel stdout
	    % web::log info {Websh is cool}
	    03/01/00 00:00:00 [111] user.info: Websh
	    %