1Appender::Screen(3) User Contributed Perl Documentation Appender::Screen(3)
2
3
4
6 Log::Log4perl::Appender::Screen - Log to STDOUT/STDERR
7
9 use Log::Log4perl::Appender::Screen;
10
11 my $app = Log::Log4perl::Appender::Screen->new(
12 autoflush => 1,
13 stderr => 0,
14 utf8 => 1,
15 );
16
17 $file->log(message => "Log me\n");
18
20 This is a simple appender for writing to STDOUT or STDERR.
21
22 The constructor new() takes an optional parameter "stderr":
23
24 • If set to a false value, it will log all levels to STDOUT (or, more
25 accurately, whichever file handle is selected via select(), STDOUT
26 by default).
27
28 • If set to a hash, then any "log4p_level" with a truthy value will
29 dynamically use STDERR, or STDOUT otherwise.
30
31 • Otherwise, if a true value (the default setting is 1), messages
32 will be logged to STDERR.
33
34 # All messages/levels to STDERR
35 my $app = Log::Log4perl::Appender::Screen->new(
36 stderr => 1,
37 );
38
39 # Only ERROR and FATAL to STDERR (case-sensitive)
40 my $app = Log::Log4perl::Appender::Screen->new(
41 stderr => { ERROR => 1, FATAL => 1},
42 );
43
44 Design and implementation of this module has been greatly inspired by
45 Dave Rolsky's "Log::Dispatch" appender framework.
46
47 To enable printing wide utf8 characters, set the utf8 option to a true
48 value:
49
50 my $app = Log::Log4perl::Appender::Screen->new(
51 stderr => 1,
52 utf8 => 1,
53 );
54
55 This will issue the necessary binmode command to the selected output
56 channel (stderr/stdout).
57
58 To enable autoflush, set the "autoflush" option to a true value:
59
60 my $app = Log::Log4perl::Appender::Screen->new(
61 autoflush => 1,
62 );
63
64 This will issue the necessary autoflush command to the selected output
65 channel (stderr/stdout).
66
67 This is required in containers, especially when the log volume is low,
68 to not buffer the log messages and cause a significant delay.
69
71 Copyright 2002-2013 by Mike Schilli <m@perlmeister.com> and Kevin Goess
72 <cpan@goess.org>.
73
74 This library is free software; you can redistribute it and/or modify it
75 under the same terms as Perl itself.
76
78 Please contribute patches to the project on Github:
79
80 http://github.com/mschilli/log4perl
81
82 Send bug reports or requests for enhancements to the authors via our
83
84 MAILING LIST (questions, bug reports, suggestions/patches):
85 log4perl-devel@lists.sourceforge.net
86
87 Authors (please contact them via the list above, not directly): Mike
88 Schilli <m@perlmeister.com>, Kevin Goess <cpan@goess.org>
89
90 Contributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens
91 Berthold, Jeremy Bopp, Hutton Davidson, Chris R. Donnelly, Matisse
92 Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon, Carl Franks, Dennis
93 Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier David
94 Hull, Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter,
95 Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, Lars
96 Thegler, David Viner, Mac Yang.
97
98
99
100perl v5.36.0 2023-01-20 Appender::Screen(3)