Why is my Apache2 :: Log output replacing newlines \ n?
I have installed several vhosts under apache2 / mod_perl. I used a directive ErrorLog
to get a separate error log for each vhost. This only worked when I was using Apache2 :: Log. 'warn' will only be logged in the regular error log.
So everything works. Finally. But one problem remains: when I log via $ r-> log_error, I find that new lines are replaced with\n
Any idea why this is happening and how can I fix it?
Thank.
source to share
This is not a mod_perl problem, but Apache. Apparently there are some security issues when printing non-fledged output to error logs (I'm not really sure why), so you need to explicitly enable this in Apache when building / configuring it with this:
CFLAGS=-DAP_UNSAFE_ERROR_LOG_UNESCAPED ./configure
If you are using apache already installed you cannot do this to change this.
source to share
I know this is a very old thread, but still at the top of google results, so to help everyone, the following changes to mod_perl.pl really helped me:
comment below:
BEGIN { *CORE::GLOBAL::warn = \&Apache2::ServerRec::warn; }
above for: Provide warnings to the virtual host log rather than the primary server log.
Hope this helps someone like me :)
source to share