2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 09:13:08 +00:00

workaround ($4929) the MsgUtil.pm first to make sure xcatd will not crash when /dev/log is not ready. (#4974)

This commit is contained in:
Bin Xu 2018-03-27 14:04:51 +08:00 committed by yangsong
parent a9ce890a6c
commit 6d8081142b

View File

@ -486,7 +486,8 @@ sub message
if ($errstr)
{
print $stdouterrf
"Unable to log $rsp to syslog because of $errstr\n";
"Error: Unable to log to syslog: $errstr\n";
print "$rsp\n";
}
}
@ -896,9 +897,6 @@ sub trace() {
if (($level eq "I") || ($level eq "i")) { $prefix = "INFO"; }
if (($level eq "D") || ($level eq "d")) { $prefix = "DEBUG"; }
my @tmp = xCAT::TableUtils->get_site_attribute("xcatdebugmode");
my $xcatdebugmode = $tmp[0];
if (($level eq "E")
|| ($level eq "e")
|| ($level eq "I")
@ -911,8 +909,15 @@ sub trace() {
syslog("$prefix", $msg);
closelog();
};
if ($@) {
print "Error: Unable to log to syslog: $@\n";
print "$msg\n";
}
return;
}
my @tmp = xCAT::TableUtils->get_site_attribute("xcatdebugmode");
my $xcatdebugmode = $tmp[0];
if (($level eq "D")
|| ($level eq "d")) {
if (($verbose == 1) || ($xcatdebugmode eq "1") || ($xcatdebugmode eq "2")) {
@ -921,6 +926,10 @@ sub trace() {
openlog("xcat", "nofatal,pid", "local4");
syslog("$prefix", $msg);
closelog();
};
if ($@) {
print "Error: Unable to log to syslog: $@\n";
print "$msg\n";
}
}
}