pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:

Greetings, ye monks so monkey.

I have a really weird problem with Sys::Syslog. In Linux, it seems to work normally, and on OpenBSD I get nothing. No log messages, no errors, nothing.

Does anyone know why this might be? Or does anyone know a good way to get verbosity from Sys::Syslog or syslogd? I'm hoping for someone who understands the underpinnings of syslog and might know what's going on here. Since it works on Linux, I don't think it's a problem with my code.

I've tried a few different log levels and facilities.

#! /usr/bin/perl -w -T use strict; use Sys::Syslog qw(:standard :macros); openlog('Wibble','pid,nowait',LOG_USER) || die "Whaaaaaa\n"; syslog(LOG_ALERT,"This is a test") || die "BOO HOO\n" ;
UPDATE:

If I specify 'unix' as the connection type, it works. So, I still don't know what the real problem was, but at least I can get on with my work...

setlogsock('unix')

Replies are listed 'Best First'.
Re: Sys::Syslog Troubles
by jethro (Monsignor) on Jun 25, 2008 at 17:08 UTC
    Did you check that /etc/syslog.conf is comparable on both systems, i.e. that your message should generate a log message on bsd too ? Is a there a file to write the message into (there are syslogds that don't write to a log file if it doesn't exist already) ?

    I would put an strace (or whatever bsd has for that) on syslogd. Whenever your program generates a message, you should see activity in that process. If yes, there is something wrong with syslogds config, if no, the fault lies with Sys::Syslog.

Re: Sys::Syslog Troubles
by Tanktalus (Canon) on Jun 25, 2008 at 22:35 UTC

    FYI - my personal experience: I've had much more luck with Unix::Syslog. That, and the author of Unix::Syslog did a wonderful job of using scare tactics to keep me there ;-)