From 694df9c1c6ec244c416c2d8e85657651b6a28dab Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Mon, 9 Apr 2018 22:51:08 -0400 Subject: Bug 1450679 - Replace custom Sentry integration with Logging --- Log/Log4perl/Layout/Mozilla.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Log') diff --git a/Log/Log4perl/Layout/Mozilla.pm b/Log/Log4perl/Layout/Mozilla.pm index 67a070c54..b625c54f4 100644 --- a/Log/Log4perl/Layout/Mozilla.pm +++ b/Log/Log4perl/Layout/Mozilla.pm @@ -52,6 +52,7 @@ sub render { ); my $mdc = Log::Log4perl::MDC->get_context; + my $fields = $mdc->{fields} // {}; my %out = ( EnvVersion => LOGGING_FORMAT_VERSION, Hostname => $HOSTNAME, @@ -60,12 +61,12 @@ sub render { Severity => $Log::Log4perl::Level::SYSLOG{$priority}, Timestamp => time() * 1e9, Type => $category, - Fields => { msg => $msg, %$mdc }, + Fields => { msg => $msg, %$fields }, ); my $json_text = $JSON->encode(\%out) . "\n"; if (length($json_text) > $self->max_json_length) { - my $scary_msg = sprintf( "DANGER! LOG MESSAGE TOO BIG %d > %d", length($json_text), $self->max_json_length ); + my $scary_msg = sprintf 'DANGER! LOG MESSAGE TOO BIG %d > %d', length($json_text), $self->max_json_length; $out{Fields} = { remote_ip => $mdc->{remote_ip}, msg => $scary_msg }; $out{Severity} = 1; # alert $json_text = $JSON->encode(\%out) . "\n"; -- cgit v1.2.3-24-g4f1b