为什么我的 Apache2::Log 输出用 \n 替换换行符?
我在 apache2 / mod_perl 下设置了多个虚拟主机。我使用 ErrorLog
指令为每个虚拟主机获取单独的错误日志。仅当我使用 Apache2::Log 时,这才按预期工作。 “警告”只会记录到常规错误日志中。
这样就可以了。最后。但还存在一个问题:当我通过 $r->log_error 登录时,我发现换行符被替换为 \n
知道为什么会发生这种情况以及如何修复它吗?
谢谢。
I've set up multiple vhosts under apache2 / mod_perl. I used the ErrorLog
directive to get a separate error log for each vhost. This only worked as expected when I used Apache2::Log. 'warn' would only log to the regular error log.
So that's all working. Finally. But there's one issue remaining: When I log via $r->log_error, I find that newlines are replaced with \n
Any idea why this happens, and how it can be fixed?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这不是mod_perl问题,而是一个apache。 对于错误日志打印未设计的输出(我不确定为什么)存在一些安全问题
显然, 您无能为力改变这一点。
This is not a mod_perl problem, but an Apache one. Apparently there are some security concerns with printing unescaped output to the error logs (I'm not entirely sure why) so you have to explicitly enable this in Apache when building/configuring it using this:
If you're using an already installed apache, there's not much you can do to change this.
如果您具有预构建的安装,则可以使用此代码线来解决该问题,但必须包含在VHOST内的每个页面执行中,例如header.php或config.php文件。
If you have a pre-built install, you can use this line of code to fix the issue but it must be included in every page execution within your vhost, say in a header.php or config.php file.
我知道这是一个非常古老的线程,但仍然在谷歌结果中名列前茅,所以为了帮助所有人,mod_perl.pl 中的以下更改确实帮助了我:
下面注释掉:
上面的内容是:
将警告写入虚拟主机的日志,而不是主服务器日志。
我希望这对像我这样的人有帮助:)
i know this is very old thread, but still coming on top on google results, so just to help all, the following changes in mod_perl.pl did helped me:
comment out below:
the above is for:
Make warnings go to the virtual host's log and not the main server log.
i hope this helps anyone out there like me :)