3 In https://github.com/plack/Plack/commit/cafa5db84921f020183a9c834fd6a4541e5a6b84
4 chansen made a change to the FCGI handler in Plack, in which he replaced
5 STDERR, STDOUT and STDIN with proper IO::Handle objects.
7 The side effect of that change is that catalyst outputing logs on STDERR will
8 no longer end up by default in the error log of the webserver when running
9 under FCGI. This test tries to make sure we use the propper parts of the psgi
10 environment when we output things from Catalyst::Log.
12 There is one more "regression", and that is warnings. By using
13 Catalyst::Plugin::LogWarnings, you also get those in the right place if this
22 use lib "$FindBin::Bin/lib";
27 use File::Temp qw/ tempdir /;
33 use HTTP::Request::Common;
39 has 'log' => (is => 'ro', isa => 'ArrayRef', traits => ['Array'], default => sub { [] },
49 #subtest "psgi.errors" => sub
52 my $handle = MockHandle->new();
59 $env->{'psgi.errors'} = $handle;
60 my $res = $app->($env);
70 my $res = $cb->(GET "/log/debug");
71 my @logs = $handle->logs;
72 is(scalar(@logs), 1, "psgi.errors: one event output");
73 like($logs[0], qr/debug$/, "psgi.errors: event matches test data");
77 #subtest "psgix.logger" => sub
89 $env->{'psgix.logger'} = $logger;
98 my $res = $cb->(GET "/log/debug");
99 is(scalar(@logs), 1, "psgix.logger: one event logged");
100 is_deeply($logs[0], { level => 'debug', message => "debug" }, "psgix.logger: right stuff");