diff --git a/perl-xCAT/xCAT/MsgUtils.pm b/perl-xCAT/xCAT/MsgUtils.pm index 4e3bf292c..d4876281e 100644 --- a/perl-xCAT/xCAT/MsgUtils.pm +++ b/perl-xCAT/xCAT/MsgUtils.pm @@ -897,42 +897,24 @@ sub trace() { if (($level eq "I") || ($level eq "i")) { $prefix = "INFO"; } if (($level eq "D") || ($level eq "d")) { $prefix = "DEBUG"; } - if (($level eq "E") - || ($level eq "e") - || ($level eq "I") - || ($level eq "i") - || ($level eq "W") - || ($level eq "w")) { - my $msg = $prefix . " " . $logcontent; - eval { - openlog("xcat", "nofatal,pid", "local4"); - syslog("$prefix", $msg); - closelog(); - }; - if ($@) { - print "Error: Unable to log to syslog: $@\n"; - print "$msg\n"; - } - return; + return unless ($prefix); #unknown level, do nothing. + + if (($verbose == 0) && ($prefix eq "DEBUG")) { + my @tmp = xCAT::TableUtils->get_site_attribute("xcatdebugmode"); + my $xcatdebugmode = $tmp[0]; + return unless (($xcatdebugmode == 1) || ($xcatdebugmode == 2)); } - 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")) { - my $msg = $prefix . " " . $logcontent; - eval { - openlog("xcat", "nofatal,pid", "local4"); - syslog("$prefix", $msg); - closelog(); - }; - if ($@) { - print "Error: Unable to log to syslog: $@\n"; - print "$msg\n"; - } - } + eval { + openlog("xcat", "nofatal,pid", "local4"); + syslog("$prefix", $logcontent); + closelog(); + }; + if ($@) { + print "Error: Unable to log to syslog: $@\n"; + print "$prefix . $logcontent\n"; } + } #------------------------------------------------------------------ diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 53c1ab745..f8e83a6a3 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -844,14 +844,14 @@ sub do_udp_service { # This function opens up a UDP port #notify the client that its request is been processing my $ret=xCAT::NetworkUtils->send_tcp_msg($clientip,3001,"processing"); if($ret){ - xCAT::MsgUtils->message("S", "INFO xcatd: fail to notify $clientip that its 'findme' request is been processing"); + xCAT::MsgUtils->message("S", "xcatd: fail to notify $clientip that its 'findme' request is been processing"); } } elsif ($data =~ /^ $data, sockaddr => $clientip, sport => $sport }, $discoctl); #notify the client that its request is been processing my $ret=xCAT::NetworkUtils->send_tcp_msg($clientip,3001,"processing"); if($ret){ - xCAT::MsgUtils->message("S", "INFO xcatd: fail to notify $clientip that its 'findme' request is been processing"); + xCAT::MsgUtils->message("S", "xcatd: fail to notify $clientip that its 'findme' request is been processing"); } } else { # for *now*, we'll do a tiny YAML subset @@ -1212,7 +1212,7 @@ unless ($cmdlog_svrpid) { if ($clientsock) { close($clientsock); } if (-e $cmdlogservicefile) { unlink("$cmdlogservicefile"); } if ($cmdlogsvrlistener) { close($cmdlogsvrlistener); } - xCAT::MsgUtils->message("S", "INFO xcatd: 'Command log writer' process $$ is terminated by USR2 signal"); + xCAT::MsgUtils->message("S", "xcatd: 'Command log writer' process $$ is terminated by USR2 signal"); exit(0); }; @@ -1222,7 +1222,7 @@ unless ($cmdlog_svrpid) { if ($clientsock) { close($clientsock); } if (-e $cmdlogservicefile) { unlink("$cmdlogservicefile"); } if ($cmdlogsvrlistener) { close($cmdlogsvrlistener); } - xCAT::MsgUtils->message("S", "INFO xcatd: 'Command log writer' process $$ is terminated by TERM or INT signal"); + xCAT::MsgUtils->message("S", "xcatd: 'Command log writer' process $$ is terminated by TERM or INT signal"); exit(0); }; @@ -1246,10 +1246,10 @@ unless ($cmdlog_svrpid) { $cmdlogfileswitch = 1; } if (!$trytime) { - xCAT::MsgUtils->message("S", "INFO xcatd: 'Command log writer' process $$ get HUP signal, reopen commands.log file failed, send TERM signal to kill itself"); + xCAT::MsgUtils->message("S", "xcatd: 'Command log writer' process $$ get HUP signal, reopen commands.log file failed, send TERM signal to kill itself"); kill 'INT', $$; } else { - xCAT::MsgUtils->message("S", "INFO xcatd: 'Command log writer' process $$ get HUP signal, reopen commands.log file"); + xCAT::MsgUtils->message("S", "xcatd: 'Command log writer' process $$ get HUP signal, reopen commands.log file"); } }; @@ -1260,7 +1260,7 @@ unless ($cmdlog_svrpid) { Listen => 8192); if (not $cmdlogsvrlistener and open($cmdlogpidfile, "<", "$cmdlogservicefile")) { - xCAT::MsgUtils->message("S", "INFO xcatd: 'Command log writer' process $$ is trying to get port $cmdlog_port"); + xCAT::MsgUtils->message("S", "xcatd: 'Command log writer' process $$ is trying to get port $cmdlog_port"); my $pid = <$cmdlogpidfile>; if ($pid) { kill 'USR2', $pid; @@ -1319,7 +1319,7 @@ unless ($cmdlog_svrpid) { if ($cmdlogfile) { close($cmdlogfile); } if ($cmdlogsvrlistener) { close($cmdlogsvrlistener); } - xCAT::MsgUtils->message("S", "INFO xcatd: 'Command log writer' process $$ stop"); + xCAT::MsgUtils->message("S", "xcatd: 'Command log writer' process $$ stop"); } # ----used for command log end--------- diff --git a/xCAT/etc/rsyslog.d/xcat-cluster.conf b/xCAT/etc/rsyslog.d/xcat-cluster.conf index 7e37c15a2..924d8f70a 100644 --- a/xCAT/etc/rsyslog.d/xcat-cluster.conf +++ b/xCAT/etc/rsyslog.d/xcat-cluster.conf @@ -1,3 +1,3 @@ -$template xCATTraditionalFormat0,"%timegenerated% %HOSTNAME% %syslogtag% %msg:::drop-last-lf%\n" +$template xCATTraditionalFormat0,"%timegenerated% %HOSTNAME% %syslogtag% %syslogseverity-text:::uppercase% %msg:::drop-last-lf%\n" :programname, isequal, "xcat" /var/log/xcat/cluster.log;xCATTraditionalFormat0 :programname, startswith, "xcat." /var/log/xcat/cluster.log;xCATTraditionalFormat0 diff --git a/xCAT/etc/rsyslog.d/xcat-compute.conf b/xCAT/etc/rsyslog.d/xcat-compute.conf index fa5eaa0f6..6b71f0696 100644 --- a/xCAT/etc/rsyslog.d/xcat-compute.conf +++ b/xCAT/etc/rsyslog.d/xcat-compute.conf @@ -1,3 +1,3 @@ -$template xCATTraditionalFormat9,"%timegenerated% %HOSTNAME% %syslogtag% %msg:::drop-last-lf%\n" +$template xCATTraditionalFormat9,"%timegenerated% %HOSTNAME% %syslogtag% %syslogseverity-text:::uppercase% %msg:::drop-last-lf%\n" :fromhost-ip, !isequal, "127.0.0.1" /var/log/xcat/computes.log;xCATTraditionalFormat9 & ~