shaneburgess
shaneburgess

Reputation: 15902

Perl Catalyst and FastCgi error logging issues

I have a catalyst app running through fast cgi and the apache error logs are useless.

Example:

[Thu Oct 13 08:44:35 2011] [error] [client {IP}] FastCGI: server "/usr/local/www/handprints2/script/handprints2_fastcgi.pl" stderr: |  -> handprints2::View::json->process                       | 0.000523s |, referer: https://[SERVER]/handprints2/

[Thu Oct 13 08:44:35 2011] [error] [client {IP}] FastCGI: server "/usr/local/www/handprints2/script/handprints2_fastcgi.pl" stderr: | /end                                                       | 0.000324s |, referer: https://[SERVER]handprints2/

[Thu Oct 13 08:44:35 2011] [error] [client {IP}] FastCGI: server "/usr/local/www/handprints2/script/handprints2_fastcgi.pl" stderr: '------------------------------------------------------------+-----------', referer: https://[SERVER]/handprints2/

Is there a way to fix this?

Upvotes: 3

Views: 1130

Answers (2)

Rob Lucas
Rob Lucas

Reputation: 81

I had the same problem and didn't really find the Apache log config route that convenient.

This does the job pretty well though: https://metacpan.org/pod/Catalyst::Plugin::Log::Handler

Description from CPAN:

If your Catalyst project logs many messages, logging via standard error to Apache's error log is not very clean: The log messages are mixed with other web applications' noise; and especially if you use mod_fastcgi, every line will be prepended with a long prefix.

An alternative is logging to a file. But then you have to make sure that multiple processes won't corrupt the log file. The module Log::Handler by Jonny Schulz does exactly this, because it supports message-wise flocking.

This module is a wrapper for said Log::Handler.

Upvotes: 2

dwarring
dwarring

Reputation: 4883

You can configure your own log feeds and format in apache using the TransferLog and LogFormat directives:

   TransferLog /tmp/sample.log
    LogFormat "bazinga -> %U"

See Apache 2.0 Logging Directives or Apache 1.3 Logging Directives

Upvotes: 2

Related Questions