1package Log::Log4perl::JavaMap::ConsoleAppender;
2
3use Carp;
4use strict;
5use Log::Dispatch::Screen;
6
7
8sub new {
9    my ($class, $appender_name, $data) = @_;
10    my $stderr;
11
12    if (my $t = $data->{Target}{value}) {
13        if ($t eq 'System.out') {
14            $stderr = 0;
15        }elsif ($t eq 'System.err') {
16            $stderr = 1;
17        }else{
18            die "ERROR: illegal value '$t' for $data->{value}.Target' in appender $appender_name\n";
19        }
20    }elsif (defined $data->{stderr}{value}){
21        $stderr = $data->{stderr}{value};
22    }else{
23        $stderr = 0;
24    }
25
26    return Log::Log4perl::Appender->new("Log::Dispatch::Screen",
27        name   => $appender_name,
28        stderr => $stderr );
29}
30
31
321;
33
34
35=head1 NAME
36
37Log::Log4perl::JavaMap::ConsoleAppender - wraps Log::Dispatch::Screen
38
39=head1 SYNOPSIS
40
41
42=head1 DESCRIPTION
43
44Possible config properties for log4j ConsoleAppender are
45
46    Target (System.out, System.err, default is System.out)
47
48Possible config properties for Log::Dispatch::Screen are
49
50    stderr (0 or 1)
51
52=head1 SEE ALSO
53
54http://jakarta.apache.org/log4j/docs/
55
56Log::Log4perl::Javamap
57
58Log::Dispatch::Screen
59
60=cut 
61
62=head1 LICENSE
63
64Copyright 2002-2012 by Mike Schilli E<lt>m@perlmeister.comE<gt>
65and Kevin Goess E<lt>cpan@goess.orgE<gt>.
66
67This library is free software; you can redistribute it and/or modify
68it under the same terms as Perl itself.
69
70=head1 AUTHOR
71
72Please contribute patches to the project on Github:
73
74    http://github.com/mschilli/log4perl
75
76Send bug reports or requests for enhancements to the authors via our
77
78MAILING LIST (questions, bug reports, suggestions/patches):
79log4perl-devel@lists.sourceforge.net
80
81Authors (please contact them via the list above, not directly):
82Mike Schilli <m@perlmeister.com>,
83Kevin Goess <cpan@goess.org>
84
85Contributors (in alphabetical order):
86Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp, Hutton
87Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony
88Foiani, James FitzGibbon, Carl Franks, Dennis Gregorovic, Andy
89Grundman, Paul Harrington, David Hull, Robert Jacobson, Jason Kohles,
90Jeff Macdonald, Markus Peter, Brett Rann, Peter Rabbitson, Erik
91Selberg, Aaron Straup Cope, Lars Thegler, David Viner, Mac Yang.
92
93