Subject: | Log::Dispatch::Syslog throws exceptions on logging |
Log::Dispatch::Syslog::log_message() calls Sys::Syslog::syslog(), which
may do a syswrite(). When the log message contains a wide character, my
perl (v5.8.8 built for i386-freebsd-64int) will throw an exception. This
exception is not caught by Log::Dispatch::Syslog.
I think it is critical that Log::Dispatch::Syslog catches and/or
prevents this exception. Otherwise, the programmer has to wrap every log
operation in an eval, just because someday someone might add the very
useful Log::Dispatch::Syslog as an appender to a Log::Log4perl
configuration.
A quick fix would be to use an eval block in
Log::Dispatch::Syslog::log_message() and warn when $@ is set.
When Encode is avaliable, the following code should prevent the exception:
$p{message} = encode("utf8", $p{message}) if is_utf8($p{message});
If you're interested in this solution, I can write a patch and some tests.