Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Log-Dispatch CPAN distribution.

Report information
The Basics
Id: 35270
Status: resolved
Priority: 0/
Queue: Log-Dispatch

People
Owner: Nobody in particular
Requestors: ntyni [...] iki.fi
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.21
Fixed in: 2.22



Subject: please handle Sys::Syslog croaking
Hi, the Log::Dispatch::Syslog module isn't prepared at all for Sys::Syslog calling croak() (as documented) when syslogd isn't running. % perl -MLog::Dispatch::Syslog -e 'Log::Dispatch::Syslog->new(name=>"t",min_level=>"info")->log(message=>"test",level=>"notice"); exit 0'; echo $? no connection to syslog available - /dev/log is not a socket at /usr/share/perl5/Log/Dispatch/Syslog.pm line 77 2 See http://rt.cpan.org/Public/Bug/Display.html?id=17316 , where the Sys::Syslog maintainer argues that clients should be calling openlog() in an eval{} block. Quoting: [...] the module works exactly as documented, and since a long time, even before it was documented to do so. Looking at the source of old versions, back to the one included in 5.003, openlog() would croak() if it couldn't connect to a syslog service, so accessing your request would mean changing a decade-old behaviour. By the way, why not using the classical Perl way to handle exceptions: eval { openlog(...) }; doe something_else() if $@; An alternative to the eval{} block is to use the 'nonfatal' option introduced in Sys::Syslog 0.15. Please consider one of these. (For the record, this bug is also http://bugs.debian.org/469155) Thanks for your work on Log::Dispatch, -- Niko Tyni ntyni@iki.fi