Fw: Re: syslog under Linux (RESOLVED!)
Milan Sorm
xsorm na informatics.muni.cz
Sobota Květen 1 23:52:47 MEST 1999
Pred casem se tu vyskytl dotaz na Sys::SysLog a jeho nefunkcnost. V
comp.os.perl.misc to zrejme vyresily nasledovne. Treba to nekomu z nas
pomuze:
------------------------------------------------------------------------------
# >Several of us (Linux users) have noticed that using syslog has failed
# >with the Red Hat release. I've upgraded to Perl 5.00502 and I think I
# >may have a solution:
# >
# > use Sys::Syslog qw(:DEFAULT setlogsock);
# >
# > $program = "Foo";
# >
# > setlogsock('unix'); # This is the difference ???
# > openlog("$program $$", 'ndelay', 'user');
# > syslog('notice', 'fooprogram: this is really done');
# >
# >The following code fragment works on my Linux box where I've upgraded
# >but fails on the older (rpm installed) version. I hope this helps.
#
# I'm aware of the fact that upgrading to a newer version of Perl is a
# better solution, but the following could be used as a temporary
# workaround (RedHat 5.2).
#
# Edit '/usr/lib/perl5/Sys/Syslog.pm' and change:
#
# @EXPORT = qw(openlog closelog setlogmask syslog);
# to
# @EXPORT = qw(openlog closelog setlogmask syslog setlogsock);
#
# Then in your program:
#
# use Sys::Syslog;
#
# setlogsock('unix');
# openlog('program', 'pid', 'user');
# syslog('debug', 'This works');
milan sorm
Další informace o konferenci Perl