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

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

View File

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