For more information... RTFM!
NAVIGATION
PAGES THAT LINK HERE
ACCOUNT LOGIN

You are not logged in

Powered by Interchange version 5.7.0

SysLog

Instruct Interchange to log to the standard UNIX syslog facility.

Synopsis

SysLog  key  value

Scope

This directive is only available for use in the global (interchange.cfg) configuration file, and will affect all websites running under the Interchange installation.  It will not work in a website's local (catalog.cfg) configuration file. 

Description

This directive instructs Interchange to send log messages to the standard UNIX syslog daemon.

A simple SysLog setup could look like this: 

SysLog  command  /usr/bin/logger
SysLog  tag      int1
SysLog  alert    local3.warn
SysLog  warn     local3.info
SysLog  info     local3.info
SysLog  debug    local3.debug

The above would cause messages to be logged using "/usr/bin/logger -t int1 -p local3.alert ...".  The generated system log entries would look something like the following:

Oct 26 17:30:11 bill int1: Config 'co' at server startup
Oct 26 17:30:11 bill int1: Config 'homefn' at server startup
Oct 26 17:30:11 bill int1: Config 'simple' at server startup
Oct 26 17:30:11 bill int1: Config 'test' at server startup
Oct 26 17:30:13 bill int1: START server (2345) (INET and UNIX)

As you might know, messages sent with SysLog switched on will reach the syslog daemon sooner or later.  There, they are examined and "routed" to their final destination.  For BSD-compatible syslog daemons, the configuration file is probably "/etc/syslog.conf" and the configuration snippet needed to route Interchange messages to "/var/log/interchange.log" is as follows:

# send local3 messages to the Interchange log
local3.*                /var/log/interchange.log

Besides just tuning the syslog settings and priority settings, it is also possible to specify an external command to invoke for sending syslog messages.  This also means it is possible to hook into the message logging system and route messages where ever you want.  For example, something similar to the following custom wrapper could be created to log messages to a database:

#!/usr/bin/perl
 
use DBI;
use Getopt::Std;

my $script_name = 'logdatabase';
 
getopts('d:p:T:k:') or die "$script_name options: $@";
use vars qw/$opt_d $opt_p $opt_T $opt_k/;
 
my $dsn = $opt_d || $ENV{DBI_DSN};
my $template = $opt_T || "insert into log values ('~~KEY~~', '~~LEVEL~~', '~~MSG~~')";
 
local ($/) = undef;

my %data;
$data{KEY} = $opt_k || '';
$data{MSG} = <>;
$data{LEVEL} = $opt_p || 'interchange.info';
 
$template =~ s/\~\~(\w+)\~\~/$dbh->quote($data{$1})/;
 
my $dbh = DBI->connect($dsn)
    or die "$script_name cannot connect to DBI: $DBI::errstr\n";

my $sth = $dbh->prepare($template)
    or die "$script_name error executing query: $template\n";

$sth->execute()
    or die "$script_name error executing query: $template\n";
 
exit 0;

Category:  Global config directives
Last modified by: Kevin Walsh
Modification date: Wednesday 21 June 2006 at 5:18 PM (EDT)
Home  |  Legal nonsense  |  Privacy policy  |  Contact us