Page 1 of 1

Can't configure the rewrite log

PostPosted: 18. December 2012 13:42
by luismartin
I'd like to enable the rewrite log to debug some rewrite rules that are giving me problems. So I added these lines at the end of my httpd.conf file:

Code: Select all
<IfModule mod_rewrite.c>
   RewriteLog "/logs/rewrite.log"
   RewriteLogLevel 4

Then I restarted Apache. However it won't start. This is what I get in the XAMPP Control Panel:

Code: Select all
13:14:56  [Apache]    Error: Apache shutdown unexpectedly.
13:14:56  [Apache]    This may be due to a blocked port, missing dependencies,
13:14:56  [Apache]    improper privileges, a crash, or a shutdown by another method.
13:14:56  [Apache]    Check the "/xampp/apache/logs/error.log" file
13:14:56  [Apache]    and the Windows Event Viewer for more clues

I don't get any clue in error.log though. In fact no line is generated when this error occurs.

I also tried changing the RewriteLog line to use an absolute path:
Code: Select all
RewriteLog "c:\xampp\apache\logs\rewrite.log"

Could you please help me?

Re: Can't configure the rewrite log

PostPosted: 19. December 2012 12:10
by luismartin
Problem solved!

Apache 2.4 doesn't use the RewriteLog directive anymore. Instead, you must append this command mod_rewrite.c:traceX to the LogLevel line, where X represents the verbosity level from 0 to 8. Then if you have, like in my default case, LogLevel warn, and I want a level 4, you should do this in httpd.conf:

Code: Select all
LogLevel warn mod_rewrite.c:trace4

Rewrites will be logged in the error.log or wherever you defined the errors log. This is a little inconvenience because as far as I know, it's not possible to use another log.

I hope this helps anyone else who bumps into the same problem.