From 05e277c3d33ed64d505ed4eaeef30dc5c9f3abea Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Wed, 28 Mar 2018 14:18:50 +0200 Subject: [PATCH] add patch for more std log format --- debian/patches/JohannesLogFormat.patch | 70 ++++++++++++++++++++++++++ debian/patches/series | 2 + 2 files changed, 72 insertions(+) create mode 100644 debian/patches/JohannesLogFormat.patch create mode 100644 debian/patches/series diff --git a/debian/patches/JohannesLogFormat.patch b/debian/patches/JohannesLogFormat.patch new file mode 100644 index 0000000..b070505 --- /dev/null +++ b/debian/patches/JohannesLogFormat.patch @@ -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() ); diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..695fa78 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +JohannesLogFormat.patch +