]>
git.proxmox.com Git - pve-common.git/blob - src/PVE/SafeSyslog.pm
1 package PVE
::SafeSyslog
;
10 our $VERSION = '1.00';
13 our @EXPORT = qw(syslog initlog);
15 my $log_tag = "unknown";
17 # never log to console - thats too slow, and
18 # it corrupts the DBD database connection!
21 eval { Sys
::Syslog
::syslog
(@_); }; # ignore errors
25 my ($tag, $facility) = @_;
28 $tag = basename
($tag);
30 $tag = encode
("ascii", decode_utf8
($tag));
35 $facility = "daemon" if !$facility;
37 # never log to console - thats too slow
38 Sys
::Syslog
::setlogsock
('unix');
40 Sys
::Syslog
::openlog
($log_tag, 'pid', $facility);