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 my $cmp = TestApp->debug ? '>=' : '==';
51 #subtest "psgi.errors" => sub
54 my $handle = MockHandle->new();
61 $env->{'psgi.errors'} = $handle;
62 my $res = $app->($env);
72 my $res = $cb->(GET "/log/info");
73 my @logs = $handle->logs;
74 cmp_ok(scalar(@logs), $cmp, 1, "psgi.errors: one event output");
75 like($logs[0], qr/info$/m, "psgi.errors: event matches test data");
79 #subtest "psgix.logger" => sub
91 $env->{'psgix.logger'} = $logger;
100 my $res = $cb->(GET "/log/info");
101 cmp_ok(scalar(@logs), $cmp, 1, "psgix.logger: one event logged");
102 is(scalar(grep { $_->{level} eq 'info' and $_->{message} eq 'info' } @logs),
103 1, "psgix.logger: right stuff");