Perl Catalyst 和 FastCgi 错误日志记录问题

发布于 12-09 13:56 字数 856 浏览 1 评论 0原文

我有一个通过快速 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/

有办法解决这个问题吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

晌融2024-12-16 13:56:13

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

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

请参阅 Apache 2.0 日志指令Apache 1.3 日志指令

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

天邊彩虹2024-12-16 13:56:13

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

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

来自 CPAN 的描述:

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

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

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文