TCLUG Development Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
syslog in perl
Any suggestions as to why this code doesn't produce anything in my logs?
---
sub create_account {
use Sys::Syslog;
my ($acct_name, $acct_pass);
openlog($appname, 'pid', 'user');
#openlog($appname, 'pid', 'authpriv');
while ($#_ > 0) {
$acct_name = shift;
$acct_pass = shift;
if (defined getpwnam($acct_name)) {
my $new_name = generate_name($acct_name);
print "$acct_name exists. Try $new_name?\r\n";
} else {
my $message = "Would create user $acct_name, password $acct_pass\r\n";
print $message;
syslog('info', $message);
#syslog('notice', $message);
}
}
closelog();
}
---
If I send a batch of three user/password pairs into this sub, the second
appears on an xconsole if I openlog with 'cons,puid', but the other two do
not. All three appear on STDOUT regardless.
I also have
---
# Log everything on tty9
*.* /dev/tty9
---
in /etc/syslog.conf, but nothing shows up there either.
syslog.ph exists; it was installed by apt as part of the perl-5.005 package
in /usr/lib/perl5/5.005/i386-linux/ and /usr/lib/perl5/5.005/i386-linux/sys/,
but they don't appear to be the same - the one in sys is much larger (3574
bytes vs. 53) than the other.
I initially tried logging the messages as authpriv/notice (the lines that are
commented out), but switched it to user/info because that's what the examples
on the manpage use and I thought I might have just gotten the facility/
priority strings wrong.
--
"Two words: Windows survives." - Craig Mundie, Microsoft senior strategist
"So does syphillis. Good thing we have penicillin." - Matthew Alton
Geek Code 3.1: GCS d- s+: a- C++ UL++$ P+>+++ L+++>++++ E- W--(++) N+ o+
!K w---$ O M- V? PS+ PE Y+ PGP t 5++ X+ R++ tv b+ DI++++ D G e* h+ r++ y+