| 1 | package Log::Log4perl::JavaMap::FileAppender; | ||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use Log::Dispatch::File; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||
| 8 | 5 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=14 SCAR=44.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 9 | 5 | my ($class, $appender_name, $data) = @_; | |||||||||||||||||||||||||||||||||||
| 10 | 5 | my $stderr; | |||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||
| 12 | my $filename = $data->{File}{value} || | ||||||||||||||||||||||||||||||||||||
| 13 | $data->{filename}{value} || | ||||||||||||||||||||||||||||||||||||
| 14 | 5 | ▶ | die "'File' not supplied for appender '$appender_name', required for a '$data->{value}'\n"; | ||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$data->{'File'}{'value'} || $data->{'filename'}{'value'} || die("'File' not supplied for appender '${appender_name}', required for a '$data->{'value'}'\n")
$data->{"File"}{"value"} or $data->{"filename"}{"value"}
MC/DC0%0/2
$data->{'File'}{'value'} || $data->{'filename'}{'value'} || die("'File' not supplied for appender '${appender_name}', required for a '$data->{'value'}'\n")
$data->{"File"}{"value"}
$data->{"filename"}{"value"}
Truth table33%1/3
A or B
A= $data->{"File"}{"value"}B= $data->{"filename"}{"value"}
| |||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||
| 16 | 5 | my $mode; | |||||||||||||||||||||||||||||||||||
| 17 | 5 | ▶ | if (defined($data->{Append}{value})){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | if (lc $data->{Append}{value} eq 'true' || $data->{Append}{value} == 1){ | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
lc $data->{"Append"}{"value"} eq "true" or $data->{"Append"}{"value"} == 1
MC/DC0%0/2
lc $data->{"Append"}{"value"} eq "true" or $data->{"Append"}{"value"} == 1
lc $data->{"Append"}{"value"} eq "true"
$data->{"Append"}{"value"} == 1
Truth table0%0/3
A or B
A= lc $data->{"Append"}{"value"} eq "true"B= $data->{"Append"}{"value"} == 1
| |||||||||||||||||||||||||||||||||||||
| 19 | 0 | $mode = 'append'; | |||||||||||||||||||||||||||||||||||
| 20 | ▶ | }elsif (lc $data->{Append}{value} eq 'false' || $data->{Append}{value} == 0) { | |||||||||||||||||||||||||||||||||||
|
Condition0%0/3
lc $data->{"Append"}{"value"} eq "false" or $data->{"Append"}{"value"} == 0
MC/DC0%0/2
lc $data->{"Append"}{"value"} eq "false" or $data->{"Append"}{"value"} == 0
lc $data->{"Append"}{"value"} eq "false"
$data->{"Append"}{"value"} == 0
Truth table0%0/3
A or B
A= lc $data->{"Append"}{"value"} eq "false"B= $data->{"Append"}{"value"} == 0
| |||||||||||||||||||||||||||||||||||||
| 21 | 0 | $mode = 'write'; | |||||||||||||||||||||||||||||||||||
| 22 | }elsif($data->{Append} =~ /^(write|append)$/){ | ||||||||||||||||||||||||||||||||||||
| 23 | $mode = $data->{Append} | ||||||||||||||||||||||||||||||||||||
| 24 | 0 | }else{ | |||||||||||||||||||||||||||||||||||
| 25 | 0 | die "'$data->{Append}' is not a legal value for Append for appender '$appender_name', '$data->{value}'\n"; | |||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||
| 27 | }else{ | ||||||||||||||||||||||||||||||||||||
| 28 | 5 | $mode = 'append'; | |||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||
| 31 | 5 | my $autoflush; | |||||||||||||||||||||||||||||||||||
| 32 | 5 | ▶ | if (defined($data->{BufferedIO}{value})){ | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | if (lc $data->{BufferedIO}{value} eq 'true' || $data->{BufferedIO}{value}){ | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
lc $data->{"BufferedIO"}{"value"} eq "true" or $data->{"BufferedIO"}{"value"}
MC/DC0%0/2
lc $data->{"BufferedIO"}{"value"} eq "true" or $data->{"BufferedIO"}{"value"}
lc $data->{"BufferedIO"}{"value"} eq "true"
$data->{"BufferedIO"}{"value"}
Truth table0%0/3
A or B
A= lc $data->{"BufferedIO"}{"value"} eq "true"B= $data->{"BufferedIO"}{"value"}
| |||||||||||||||||||||||||||||||||||||
| 34 | 0 | $autoflush = 1; | |||||||||||||||||||||||||||||||||||
| 35 | ▶ | }elsif (lc $data->{BufferedIO}{value} eq 'true' || ! $data->{BufferedIO}{value}) { | |||||||||||||||||||||||||||||||||||
|
Condition0%0/3
lc $data->{"BufferedIO"}{"value"} eq "true" or not $data->{"BufferedIO"}{"value"}
MC/DC0%0/2
lc $data->{"BufferedIO"}{"value"} eq "true" or not $data->{"BufferedIO"}{"value"}
lc $data->{"BufferedIO"}{"value"} eq "true"
not $data->{"BufferedIO"}{"value"}
Truth table0%0/3
A or not(B)
A= lc $data->{"BufferedIO"}{"value"} eq "true"B= not $data->{"BufferedIO"}{"value"}
| |||||||||||||||||||||||||||||||||||||
| 36 | 0 | $autoflush = 0; | |||||||||||||||||||||||||||||||||||
| 37 | }else{ | ||||||||||||||||||||||||||||||||||||
| 38 | 0 | die "'$data->{BufferedIO}' is not a legal value for BufferedIO for appender '$appender_name', '$data->{value}'\n"; | |||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||
| 40 | }else{ | ||||||||||||||||||||||||||||||||||||
| 41 | 5 | $autoflush = 1; | |||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||
| 45 | 5 | return Log::Log4perl::Appender->new("Log::Dispatch::File", | |||||||||||||||||||||||||||||||||||
| 46 | name => $appender_name, | ||||||||||||||||||||||||||||||||||||
| 47 | filename => $filename, | ||||||||||||||||||||||||||||||||||||
| 48 | mode => $mode, | ||||||||||||||||||||||||||||||||||||
| 49 | autoflush => $autoflush, | ||||||||||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||
| 53 | 3 | 1; | |||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||
| 55 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||
| 57 | =head1 NAME | ||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||
| 59 | Log::Log4perl::JavaMap::FileAppender - wraps Log::Dispatch::File | ||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||
| 61 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||
| 63 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||
| 65 | Possible config properties for log4j ConsoleAppender are | ||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||
| 67 | File | ||||||||||||||||||||||||||||||||||||
| 68 | Append "true|false|1|0" default=true | ||||||||||||||||||||||||||||||||||||
| 69 | BufferedIO "true|false|1|0" default=false (i.e. autoflush is on) | ||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||
| 71 | Possible config properties for Log::Dispatch::File are | ||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||
| 73 | filename | ||||||||||||||||||||||||||||||||||||
| 74 | mode "write|append" | ||||||||||||||||||||||||||||||||||||
| 75 | autoflush 0|1 | ||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||
| 77 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||
| 79 | http://jakarta.apache.org/log4j/docs/ | ||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||
| 81 | Log::Log4perl::Javamap | ||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||
| 83 | Log::Dispatch::File | ||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||
| 85 | =head1 LICENSE | ||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||
| 87 | Copyright 2002-2026 by Mike Schilli E<lt>m@perlmeister.comE<gt> | ||||||||||||||||||||||||||||||||||||
| 88 | and Kevin Goess E<lt>cpan@goess.orgE<gt>. | ||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||
| 90 | This library is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||
| 91 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||