Fix Logger error spamming.

This commit is contained in:
Daniel Nichter
2013-06-16 22:59:43 -07:00
parent 61bf5c5e24
commit c2af32cd0f
2 changed files with 10 additions and 6 deletions

View File

@@ -183,13 +183,15 @@ sub start_online_logging {
};
if ( my $e = $EVAL_ERROR ) {
# Safegaurd: don't spam the agent log file with errors.
if ( ++$n_errors > 10 ) {
warn "$n_errors consecutive errors, no more error "
. "messages will be printed until log entries "
if ( $n_errors > 10 ) {
my $ts = ts(time, 1); # 1=UTC
warn "$ts WARNING $n_errors consecutive errors, no more "
. "error messages will be printed until log entries "
. "are sent successfully again.\n";
}
else {
warn "Error sending log entry to API: $e";
$n_errors++;
}
}
else {