3

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?

dwarring
  • 4,794
  • 1
  • 26
  • 38
shaneburgess
  • 15,702
  • 15
  • 47
  • 66
  • 2
    Not sure why I get a -1 for this. I added a few more log entries to the question. I know this is a common issue for Catalyst users but I cant find a good answer. – shaneburgess Oct 13 '11 at 18:11

2 Answers2

2

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

dwarring
  • 4,794
  • 1
  • 26
  • 38
2

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.

sid_com
  • 24,137
  • 26
  • 96
  • 187
Rob Lucas
  • 81
  • 3