【问题标题】:Perl Catalyst and FastCgi error logging issuesPerl Catalyst 和 FastCgi 错误记录问题
【发布时间】:2011-12-07 04:10:03
【问题描述】:

我有一个通过快速 cgi 运行的催化剂应用程序,而 apache 错误日志毫无用处。

例子:

[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/

有没有办法解决这个问题?

【问题讨论】:

  • 不知道为什么我会得到-1。我在问题中添加了更多日志条目。我知道这是 Catalyst 用户的常见问题,但我找不到好的答案。

标签: perl apache model-view-controller fastcgi catalyst


【解决方案1】:

您可以使用 TransferLogLogFormat 指令在 apache 中配置自己的日志提要和格式:

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

Apache 2.0 Logging DirectivesApache 1.3 Logging Directives

【讨论】:

    【解决方案2】:

    我遇到了同样的问题,并没有真正找到那么方便的 Apache 日志配置路径。

    不过,这可以很好地完成工作:https://metacpan.org/pod/Catalyst::Plugin::Log::Handler

    来自 CPAN 的说明:

    如果您的 Catalyst 项目记录了许多消息,则通过标准记录 Apache 的错误日志的错误不是很干净:日志消息是 与其他 Web 应用程序的噪音混合;特别是如果你使用 mod_fastcgi,每一行都会有一个长前缀。

    另一种方法是记录到文件。但是你必须确保 多个进程不会损坏日志文件。模块 Jonny Schulz 的 Log::Handler 正是这样做的,因为它支持 消息群发。

    该模块是上述 Log::Handler 的包装器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-04
      • 2012-02-16
      • 2012-03-02
      • 2011-07-01
      • 1970-01-01
      • 2021-07-07
      • 2011-05-01
      • 1970-01-01
      相关资源
      最近更新 更多