1Plack::Middleware::Log4Upseerrl(C3o)ntributed Perl DocumPelnatcakt:i:oMniddleware::Log4perl(3)
2
3
4
6 Plack::Middleware::Log4perl - Uses Log::Log4perl to configure logger
7
9 my $app = sub {
10 my $env = shift;
11
12 $env->{'psgix.logger'}({ level => 'error', message => 'Hi' });
13
14 return [
15 '200',
16 [ 'Content-Type' => 'text/plain' ],
17 [ "Hello World" ],
18 ];
19 };
20
21
22 # Use your own Log4perl configuration
23 use Log::Log4perl;
24 Log::Log4perl::init('/path/to/log4perl.conf');
25
26 builder {
27 # tell the logger to log with 'plack' category
28 enable "Log4perl", category => "plack";
29 $app;
30 }
31
32
33 # Configure with Log4perl middleware options
34 builder {
35 enable "Log4perl", category => "plack", conf => '/path/to/log4perl.conf';
36 $app;
37 }
38
40 Log4perl is a Plack::Middleware component that allows you to use
41 Log::Log4perl to configure the logging object "psgix.logger" for a
42 given category.
43
45 category
46 The "log4perl" category to send logs to. Defaults to '' which means
47 it send to the root logger.
48
49 conf
50 The configuration file path (or a scalar ref containing the config
51 string) for Log::Log4perl to automatically configure.
52
54 Tatsuhiko Miyagawa
55
57 Log::Log4perl
58
59 Plack::Middleware::LogDispatch
60
61
62
63perl v5.32.1 2021-01-27 Plack::Middleware::Log4perl(3)