A
A
I'm using Sys::Syslog but nothing is being written to the logs.
I'd appreciate your help on this.
This is on Solaris 2.9 on SPARC.
File /etc/syslog.conf contains
local1.info /var/log/mylog
Here's the test script.
#+++++++++++++++++++++
#!/usr/local/bin/perl
use Sys::Syslog;
use diagnostics;
use strict;
my $r;
$r = &Sys::Syslog:penlog("$0 $$", "ndelay,pid", "local1");
print STDERR "$$: openlog returned $r\n";
$r = &Sys::Syslog::syslog("info", "Test of info to local1");
print STDERR "$$: syslog returned $r\n";
$r = &Sys::Syslog::closelog();
print STDERR "$$: closelog returned $r\n";
print STDERR "$$: $0: End\n";
#---------------------------------
When I run it, I get:
$ testsyslog
6491: openlog returned Sys::Syslog::SYSLOG
6491: syslog returned 1
6491: closelog returned 1
6491: testsyslog: End
but nothing is printed to /var/log/mylog, while if I run
$ logger -p "local1.info" -t "from_logger $$" "Test1_logger"
then the following line is added to /var/log/mylog:
Apr 20 16:59:09 myhost from_logger 14256: [ID 702911 local1.info]
Test1_logger
I also tried adding (on Perl 5.8.8)
$r = &Sys::Syslog::setlogsock('stream', '/dev/conslog');
print STDERR "$$: setlogsock returned $r\n";
above the openlog() but that doesn't change the symptom.
The machine has two versions of Perl installed, Perl 5.6.1 which came
with Solaris and Perl 5.8.8 with threads. The behaviour is same with
both versions of Perl.
What am I doing wrong?
Thanks.
I'd appreciate your help on this.
This is on Solaris 2.9 on SPARC.
File /etc/syslog.conf contains
local1.info /var/log/mylog
Here's the test script.
#+++++++++++++++++++++
#!/usr/local/bin/perl
use Sys::Syslog;
use diagnostics;
use strict;
my $r;
$r = &Sys::Syslog:penlog("$0 $$", "ndelay,pid", "local1");
print STDERR "$$: openlog returned $r\n";
$r = &Sys::Syslog::syslog("info", "Test of info to local1");
print STDERR "$$: syslog returned $r\n";
$r = &Sys::Syslog::closelog();
print STDERR "$$: closelog returned $r\n";
print STDERR "$$: $0: End\n";
#---------------------------------
When I run it, I get:
$ testsyslog
6491: openlog returned Sys::Syslog::SYSLOG
6491: syslog returned 1
6491: closelog returned 1
6491: testsyslog: End
but nothing is printed to /var/log/mylog, while if I run
$ logger -p "local1.info" -t "from_logger $$" "Test1_logger"
then the following line is added to /var/log/mylog:
Apr 20 16:59:09 myhost from_logger 14256: [ID 702911 local1.info]
Test1_logger
I also tried adding (on Perl 5.8.8)
$r = &Sys::Syslog::setlogsock('stream', '/dev/conslog');
print STDERR "$$: setlogsock returned $r\n";
above the openlog() but that doesn't change the symptom.
The machine has two versions of Perl installed, Perl 5.6.1 which came
with Solaris and Perl 5.8.8 with threads. The behaviour is same with
both versions of Perl.
What am I doing wrong?
Thanks.