add patch for more std log format

This commit is contained in:
Mario Fetka 2018-03-28 14:18:50 +02:00
parent a75ecd2b5d
commit 05e277c3d3
2 changed files with 72 additions and 0 deletions

70
debian/patches/JohannesLogFormat.patch vendored Normal file
View File

@ -0,0 +1,70 @@
diff -uNr Log-Log4perl-Appender-Graylog-1.7.orig/lib/Data/DTO/GELF.pm Log-Log4perl-Appender-Graylog-1.7/lib/Data/DTO/GELF.pm
--- Log-Log4perl-Appender-Graylog-1.7.orig/lib/Data/DTO/GELF.pm 2018-03-28 14:15:13.708000000 +0200
+++ Log-Log4perl-Appender-Graylog-1.7/lib/Data/DTO/GELF.pm 2018-03-28 14:13:30.000000000 +0200
@@ -61,12 +61,27 @@
isa => 'Str',
);
-has '_line' => (
+has '_SourceLineNumber' => (
is => 'rw',
isa => 'Int',
);
-has '_file' => (
+has '_SourceFileName' => (
+ is => 'rw',
+ isa => 'Str',
+);
+
+has '_SourceClassName' => (
+ is => 'rw',
+ isa => 'Str',
+);
+
+has '_SourceMethodName' => (
+ is => 'rw',
+ isa => 'Str',
+);
+
+has '_Severity' => (
is => 'rw',
isa => 'Str',
);
@@ -83,13 +98,20 @@
}
my $trace = Devel::StackTrace->new;
+ my $subroutine_next = '';
+ my $found = 0;
foreach my $frame ( $trace->frames ) {
+
+ $subroutine_next ||= $frame->{subroutine} if ($found and $frame->{subroutine} ne "Log::Log4perl::Logger::__ANON__");
+
if ( $frame->{subroutine} eq "Log::Log4perl::Logger::__ANON__" ) {
- $self->_line( $frame->{line} );
- $self->_file( $frame->{filename} );
- $self->_facility( $frame->{package} );
+ $self->_SourceLineNumber( $frame->{line} );
+ $self->_SourceFileName( $frame->{filename} );
+ $self->_SourceClassName( $frame->{package} );
+ $found++;
}
}
+ $self->_SourceMethodName( $subroutine_next );
}
diff -uNr Log-Log4perl-Appender-Graylog-1.7.orig/lib/Log/Log4perl/Appender/Graylog.pm Log-Log4perl-Appender-Graylog-1.7/lib/Log/Log4perl/Appender/Graylog.pm
--- Log-Log4perl-Appender-Graylog-1.7.orig/lib/Log/Log4perl/Appender/Graylog.pm 2018-03-28 14:15:13.708000000 +0200
+++ Log-Log4perl-Appender-Graylog-1.7/lib/Log/Log4perl/Appender/Graylog.pm 2018-03-28 14:13:30.000000000 +0200
@@ -70,7 +70,8 @@
'_name' => $params{name},
'_category' => $params{log4p_category},
"_pid" => $$,
-
+ "_facility" => $self->{facility} || '',
+ "_Severity" => $params{log4p_level},
);
my $msg = validate_message( $packet->TO_HASH() );

2
debian/patches/series vendored Normal file
View File

@ -0,0 +1,2 @@
JohannesLogFormat.patch