eaiovnaovbqoebvqoeavibavo RollingFileAppender.pm000064400000007623147635400730011010 0ustar00package Log::Log4perl::JavaMap::RollingFileAppender; use Carp; use strict; use Log::Dispatch::FileRotate 1.10; sub new { my ($class, $appender_name, $data) = @_; my $stderr; my $filename = $data->{File}{value} || $data->{filename}{value} || die "'File' not supplied for appender '$appender_name', required for a '$data->{value}'\n"; my $mode; if (defined($data->{Append}{value})){ if (lc $data->{Append}{value} eq 'true' || $data->{Append}{value} == 1){ $mode = 'append'; }elsif (lc $data->{Append}{value} eq 'false' || $data->{Append}{value} == 0) { $mode = 'write'; }elsif($data->{Append} =~ /^(write|append)$/){ $mode = $data->{Append} }else{ die "'$data->{Append}' is not a legal value for Append for appender '$appender_name', '$data->{value}'\n"; } }else{ $mode = 'append'; } my $autoflush; if (defined($data->{BufferedIO}{value})){ if (lc $data->{BufferedIO}{value} eq 'true' || $data->{BufferedIO}{value}){ $autoflush = 1; }elsif (lc $data->{BufferedIO}{value} eq 'true' || ! $data->{BufferedIO}{value}) { $autoflush = 0; }else{ die "'$data->{BufferedIO}' is not a legal value for BufferedIO for appender '$appender_name', '$data->{value}'\n"; } }else{ $autoflush = 1; } my $max; if (defined $data->{MaxBackupIndex}{value}) { $max = $data->{MaxBackupIndex}{value}; }elsif (defined $data->{max}{value}){ $max = $data->{max}{value}; }else{ $max = 1; } my $size; if (defined $data->{MaxFileSize}{value}) { $size = $data->{MaxFileSize}{value} }elsif (defined $data->{size}{value}){ $size = $data->{size}{value}; }else{ $size = 10_000_000; } return Log::Log4perl::Appender->new("Log::Dispatch::FileRotate", name => $appender_name, filename => $filename, mode => $mode, autoflush => $autoflush, size => $size, max => $max, ); } 1; =encoding utf8 =head1 NAME Log::Log4perl::JavaMap::RollingFileAppender - wraps Log::Dispatch::FileRotate =head1 SYNOPSIS =head1 DESCRIPTION This maps log4j's RollingFileAppender to Log::Dispatch::FileRotate by Mark Pfeiffer, . Possible config properties for log4j ConsoleAppender are File Append "true|false|1|0" default=true BufferedIO "true|false|1|0" default=false (i.e. autoflush is on) MaxFileSize default 10_000_000 MaxBackupIndex default is 1 Possible config properties for Log::Dispatch::FileRotate are filename mode "write|append" autoflush 0|1 size max =head1 SEE ALSO http://jakarta.apache.org/log4j/docs/ Log::Log4perl::Javamap =head1 LICENSE Copyright 2002-2013 by Mike Schilli Em@perlmeister.comE and Kevin Goess Ecpan@goess.orgE. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 AUTHOR Please contribute patches to the project on Github: http://github.com/mschilli/log4perl Send bug reports or requests for enhancements to the authors via our MAILING LIST (questions, bug reports, suggestions/patches): log4perl-devel@lists.sourceforge.net Authors (please contact them via the list above, not directly): Mike Schilli , Kevin Goess Contributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp, Hutton Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon, Carl Franks, Dennis Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier David Hull, Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter, Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, Lars Thegler, David Viner, Mac Yang. ConsoleAppender.pm000064400000004327147635400730010202 0ustar00package Log::Log4perl::JavaMap::ConsoleAppender; use Carp; use strict; use Log::Dispatch::Screen; sub new { my ($class, $appender_name, $data) = @_; my $stderr; if (my $t = $data->{Target}{value}) { if ($t eq 'System.out') { $stderr = 0; }elsif ($t eq 'System.err') { $stderr = 1; }else{ die "ERROR: illegal value '$t' for $data->{value}.Target' in appender $appender_name\n"; } }elsif (defined $data->{stderr}{value}){ $stderr = $data->{stderr}{value}; }else{ $stderr = 0; } return Log::Log4perl::Appender->new("Log::Dispatch::Screen", name => $appender_name, stderr => $stderr ); } 1; =encoding utf8 =head1 NAME Log::Log4perl::JavaMap::ConsoleAppender - wraps Log::Dispatch::Screen =head1 SYNOPSIS =head1 DESCRIPTION Possible config properties for log4j ConsoleAppender are Target (System.out, System.err, default is System.out) Possible config properties for Log::Dispatch::Screen are stderr (0 or 1) =head1 SEE ALSO http://jakarta.apache.org/log4j/docs/ Log::Log4perl::Javamap Log::Dispatch::Screen =cut =head1 LICENSE Copyright 2002-2013 by Mike Schilli Em@perlmeister.comE and Kevin Goess Ecpan@goess.orgE. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 AUTHOR Please contribute patches to the project on Github: http://github.com/mschilli/log4perl Send bug reports or requests for enhancements to the authors via our MAILING LIST (questions, bug reports, suggestions/patches): log4perl-devel@lists.sourceforge.net Authors (please contact them via the list above, not directly): Mike Schilli , Kevin Goess Contributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp, Hutton Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon, Carl Franks, Dennis Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier David Hull, Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter, Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, Lars Thegler, David Viner, Mac Yang. JDBCAppender.pm000064400000007112147635400730007275 0ustar00package Log::Log4perl::JavaMap::JDBCAppender; use Carp; use strict; sub new { my ($class, $appender_name, $data) = @_; my $stderr; my $pwd = $data->{password}{value} || die "'password' not supplied for appender '$appender_name', required for a '$data->{value}'\n"; my $username = $data->{user}{value} || $data->{username}{value} || die "'user' not supplied for appender '$appender_name', required for a '$data->{value}'\n"; my $sql = $data->{sql}{value} || die "'sql' not supplied for appender '$appender_name', required for a '$data->{value}'\n"; my $dsn; my $databaseURL = $data->{URL}{value}; if ($databaseURL) { $databaseURL =~ m|^jdbc:(.+?):(.+?)://(.+?):(.+?);(.+)|; my $driverName = $1; my $databaseName = $2; my $hostname = $3; my $port = $4; my $params = $5; $dsn = "dbi:$driverName:database=$databaseName;host=$hostname;port=$port;$params"; }elsif ($data->{datasource}{value}){ $dsn = $data->{datasource}{value}; }else{ die "'databaseURL' not supplied for appender '$appender_name', required for a '$data->{value}'\n"; } #this part isn't supported by log4j, it's my Log4perl #hack, but I think it's so useful I'm going to implement it #anyway my %bind_value_params; foreach my $p (keys %{$data->{params}}){ $bind_value_params{$p} = $data->{params}{$p}{value}; } return Log::Log4perl::Appender->new("Log::Log4perl::Appender::DBI", datasource => $dsn, username => $username, password => $pwd, sql => $sql, params => \%bind_value_params, #warp_message also not a log4j thing, but see above warp_message=> $data->{warp_message}{value}, ); } 1; =encoding utf8 =head1 NAME Log::Log4perl::JavaMap::JDBCAppender - wraps Log::Log4perl::Appender::DBI =head1 SYNOPSIS =head1 DESCRIPTION Possible config properties for log4j JDBCAppender are bufferSize sql password user URL - attempting to translate a JDBC URL into DBI parameters, let me know if you find problems Possible config properties for Log::Log4perl::Appender::DBI are bufferSize sql password username datasource usePreparedStmt 0|1 (patternLayout).dontCollapseArrayRefs 0|1 =head1 SEE ALSO http://jakarta.apache.org/log4j/docs/ Log::Log4perl::Javamap Log::Log4perl::Appender::DBI =head1 LICENSE Copyright 2002-2013 by Mike Schilli Em@perlmeister.comE and Kevin Goess Ecpan@goess.orgE. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 AUTHOR Please contribute patches to the project on Github: http://github.com/mschilli/log4perl Send bug reports or requests for enhancements to the authors via our MAILING LIST (questions, bug reports, suggestions/patches): log4perl-devel@lists.sourceforge.net Authors (please contact them via the list above, not directly): Mike Schilli , Kevin Goess Contributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp, Hutton Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon, Carl Franks, Dennis Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier David Hull, Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter, Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, Lars Thegler, David Viner, Mac Yang. FileAppender.pm000064400000006262147635400730007457 0ustar00package Log::Log4perl::JavaMap::FileAppender; use Carp; use strict; use Log::Dispatch::File; sub new { my ($class, $appender_name, $data) = @_; my $stderr; my $filename = $data->{File}{value} || $data->{filename}{value} || die "'File' not supplied for appender '$appender_name', required for a '$data->{value}'\n"; my $mode; if (defined($data->{Append}{value})){ if (lc $data->{Append}{value} eq 'true' || $data->{Append}{value} == 1){ $mode = 'append'; }elsif (lc $data->{Append}{value} eq 'false' || $data->{Append}{value} == 0) { $mode = 'write'; }elsif($data->{Append} =~ /^(write|append)$/){ $mode = $data->{Append} }else{ die "'$data->{Append}' is not a legal value for Append for appender '$appender_name', '$data->{value}'\n"; } }else{ $mode = 'append'; } my $autoflush; if (defined($data->{BufferedIO}{value})){ if (lc $data->{BufferedIO}{value} eq 'true' || $data->{BufferedIO}{value}){ $autoflush = 1; }elsif (lc $data->{BufferedIO}{value} eq 'true' || ! $data->{BufferedIO}{value}) { $autoflush = 0; }else{ die "'$data->{BufferedIO}' is not a legal value for BufferedIO for appender '$appender_name', '$data->{value}'\n"; } }else{ $autoflush = 1; } return Log::Log4perl::Appender->new("Log::Dispatch::File", name => $appender_name, filename => $filename, mode => $mode, autoflush => $autoflush, ); } 1; =encoding utf8 =head1 NAME Log::Log4perl::JavaMap::FileAppender - wraps Log::Dispatch::File =head1 SYNOPSIS =head1 DESCRIPTION Possible config properties for log4j ConsoleAppender are File Append "true|false|1|0" default=true BufferedIO "true|false|1|0" default=false (i.e. autoflush is on) Possible config properties for Log::Dispatch::File are filename mode "write|append" autoflush 0|1 =head1 SEE ALSO http://jakarta.apache.org/log4j/docs/ Log::Log4perl::Javamap Log::Dispatch::File =head1 LICENSE Copyright 2002-2013 by Mike Schilli Em@perlmeister.comE and Kevin Goess Ecpan@goess.orgE. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 AUTHOR Please contribute patches to the project on Github: http://github.com/mschilli/log4perl Send bug reports or requests for enhancements to the authors via our MAILING LIST (questions, bug reports, suggestions/patches): log4perl-devel@lists.sourceforge.net Authors (please contact them via the list above, not directly): Mike Schilli , Kevin Goess Contributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp, Hutton Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon, Carl Franks, Dennis Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier David Hull, Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter, Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, Lars Thegler, David Viner, Mac Yang. NTEventLogAppender.pm000064400000004131147635400730010556 0ustar00package Log::Log4perl::JavaMap::NTEventLogAppender; use Carp; use strict; sub new { my ($class, $appender_name, $data) = @_; my $stderr; my ($source, # ); if (defined $data->{Source}{value}) { $source = $data->{Source}{value} }elsif (defined $data->{source}{value}){ $source = $data->{source}{value}; }else{ $source = 'user'; } return Log::Log4perl::Appender->new("Log::Dispatch::Win32EventLog", name => $appender_name, source => $source, min_level => 'debug', ); } 1; =encoding utf8 =head1 NAME Log::Log4perl::JavaMap::NTEventLogAppender - wraps Log::Dispatch::Win32EventLog =head1 DESCRIPTION This maps log4j's NTEventLogAppender to Log::Dispatch::Win32EventLog Possible config properties for log4j NTEventLogAppender are Source Possible config properties for Log::Dispatch::Win32EventLog are source Boy, that was hard. =head1 SEE ALSO http://jakarta.apache.org/log4j/docs/ Log::Log4perl::Javamap =head1 LICENSE Copyright 2002-2013 by Mike Schilli Em@perlmeister.comE and Kevin Goess Ecpan@goess.orgE. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 AUTHOR Please contribute patches to the project on Github: http://github.com/mschilli/log4perl Send bug reports or requests for enhancements to the authors via our MAILING LIST (questions, bug reports, suggestions/patches): log4perl-devel@lists.sourceforge.net Authors (please contact them via the list above, not directly): Mike Schilli , Kevin Goess Contributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp, Hutton Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon, Carl Franks, Dennis Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier David Hull, Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter, Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, Lars Thegler, David Viner, Mac Yang. SyslogAppender.pm000064400000005204147635400730010053 0ustar00package Log::Log4perl::JavaMap::SyslogAppender; use Carp; use strict; use Log::Dispatch::Syslog; sub new { my ($class, $appender_name, $data) = @_; my $stderr; my ($ident, #defaults to $0 $logopt, #Valid options are 'cons', 'pid', 'ndelay', and 'nowait'. $facility, #Valid options are 'auth', 'authpriv', # 'cron', 'daemon', 'kern', 'local0' through 'local7', # 'mail, 'news', 'syslog', 'user', 'uucp'. Defaults to # 'user' $socket, #Valid options are 'unix' or 'inet'. Defaults to 'inet' ); if (defined $data->{Facility}{value}) { $facility = $data->{Facility}{value} }elsif (defined $data->{facility}{value}){ $facility = $data->{facility}{value}; }else{ $facility = 'user'; } return Log::Log4perl::Appender->new("Log::Dispatch::Syslog", name => $appender_name, facility => $facility, min_level => 'debug', ); } 1; =encoding utf8 =head1 NAME Log::Log4perl::JavaMap::SysLogAppender - wraps Log::Dispatch::Syslog =head1 DESCRIPTION This maps log4j's SyslogAppender to Log::Dispatch::Syslog Possible config properties for log4j SyslogAppender are SyslogHost (Log::Dispatch::Syslog only accepts 'localhost') Facility Possible config properties for Log::Dispatch::Syslog are min_level (debug) max_level ident (defaults to $0) logopt facility socket (defaults to 'inet') =head1 SEE ALSO http://jakarta.apache.org/log4j/docs/ Log::Log4perl::Javamap =head1 LICENSE Copyright 2002-2013 by Mike Schilli Em@perlmeister.comE and Kevin Goess Ecpan@goess.orgE. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 AUTHOR Please contribute patches to the project on Github: http://github.com/mschilli/log4perl Send bug reports or requests for enhancements to the authors via our MAILING LIST (questions, bug reports, suggestions/patches): log4perl-devel@lists.sourceforge.net Authors (please contact them via the list above, not directly): Mike Schilli , Kevin Goess Contributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp, Hutton Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon, Carl Franks, Dennis Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier David Hull, Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter, Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, Lars Thegler, David Viner, Mac Yang. TestBuffer.pm000064400000003320147635400730007162 0ustar00package Log::Log4perl::JavaMap::TestBuffer; use Carp; use strict; use Log::Log4perl::Appender::TestBuffer; use constant _INTERNAL_DEBUG => 0; sub new { my ($class, $appender_name, $data) = @_; my $stderr; return Log::Log4perl::Appender->new("Log::Log4perl::Appender::TestBuffer", name => $appender_name); } 1; =encoding utf8 =head1 NAME Log::Log4perl::JavaMap::TestBuffer - wraps Log::Log4perl::Appender::TestBuffer =head1 SYNOPSIS =head1 DESCRIPTION Just for testing the Java mapping. =head1 SEE ALSO http://jakarta.apache.org/log4j/docs/ Log::Log4perl::Javamap Log::Dispatch::Screen =head1 LICENSE Copyright 2002-2013 by Mike Schilli Em@perlmeister.comE and Kevin Goess Ecpan@goess.orgE. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 AUTHOR Please contribute patches to the project on Github: http://github.com/mschilli/log4perl Send bug reports or requests for enhancements to the authors via our MAILING LIST (questions, bug reports, suggestions/patches): log4perl-devel@lists.sourceforge.net Authors (please contact them via the list above, not directly): Mike Schilli , Kevin Goess Contributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp, Hutton Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon, Carl Franks, Dennis Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier David Hull, Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter, Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, Lars Thegler, David Viner, Mac Yang.