summaryrefslogtreecommitdiffstats
path: root/Log/Log4perl/Layout/Mozilla.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Log/Log4perl/Layout/Mozilla.pm')
-rw-r--r--Log/Log4perl/Layout/Mozilla.pm5
1 files changed, 3 insertions, 2 deletions
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";