RewriteLogLevel

This directive sets the verbosity of the logging that will occur for rewrite directives. Valid values range from 0 - 9, with 0 being no logging at all, and 9 logging all possible information. Currently only values 1 - 4 are used within mod_rewrite. Log levels 4 - 9 will return the same results.

When looking at a line from the log, for example:

127.0.0.1 - - [19/Nov/2009:14:41:25 --0500] [vhost.example.com/sid#8475130][rid#8681480/initial] (1) pass through /paul_reinheimer.png

the number shown in round brackets (1) indicates the level of the message. You will not be shown messages with a higher log level than what you have set in the RewriteLogLevel directive. Logs will be stored in file specified by the RewriteLog directive.

Two requests will be used to demonstrate the difference between the different log levels.

  1. A request for the existing resource paul_reinheimer.png 2. A request for the non-existant resource rich_bowen.png

This rule from the examples was used:

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule . /index.php

Log Level 4 (or higher)

Existing:

127.0.0.1 - - [19/Nov/2009:14:41:25 --0500] [vhost.example.com/sid#8475130][rid#8681480/initial] (1) pass through /paul_reinheimer.png

Non-Existant:

127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (2) init rewrite engine with requested uri /rich_bowen.png
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (3) applying pattern '.' to uri '/rich_bowen.png'
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (4) RewriteCond: input='/var/www/vhost.example.com/rich_bowen.png' pattern='!-d' => matched
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (4) RewriteCond: input='/var/www/vhost.example.com/rich_bowen.png' pattern='!-f' => matched
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (2) rewrite /rich_bowen.png -> /index.php
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (2) local path result: /index.php
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (2) prefixed with document_root to /var/www/vhost.example.com/index.php
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (1) go-ahead with /var/www/vhost.example.com/index.php [OK]

Note: A separate request is also made for favicon.ico by most browsers:

127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#8681480/initial] (3) applying pattern '.' to uri '/favicon.ico'
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#8681480/initial] (4) RewriteCond: input='/var/www/vhost.example.com/favicon.ico' pattern='!-d' => matched
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#8681480/initial] (4) RewriteCond: input='/var/www/vhost.example.com/favicon.ico' pattern='!-f' => matched
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#8681480/initial] (2) rewrite /favicon.ico -> /index.php
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#8681480/initial] (2) local path result: /index.php
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#8681480/initial] (2) prefixed with document_root to /var/www/vhost.example.com/index.php
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#8681480/initial] (1) go-ahead with /var/www/vhost.example.com/index.php [OK]

Log Level 3

Existing:

127.0.0.1 - - [19/Nov/2009:14:41:25 --0500] [vhost.example.com/sid#8475130][rid#8681480/initial] (1) pass through /paul_reinheimer.png

Non-Existant:

127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (2) init rewrite engine with requested uri /rich_bowen.png
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (3) applying pattern '.' to uri '/rich_bowen.png'
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (2) rewrite /rich_bowen.png -> /index.php
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (2) local path result: /index.php
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (2) prefixed with document_root to /var/www/vhost.example.com/index.php
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (1) go-ahead with /var/www/vhost.example.com/index.php [OK]

Log Level 2

Existing:

127.0.0.1 - - [19/Nov/2009:14:41:25 --0500] [vhost.example.com/sid#8475130][rid#8681480/initial] (1) pass through /paul_reinheimer.png

Non-Existant:

127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (2) init rewrite engine with requested uri /rich_bowen.png
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (2) rewrite /rich_bowen.png -> /index.php
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (2) local path result: /index.php
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (2) prefixed with document_root to /var/www/vhost.example.com/index.php
127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (1) go-ahead with /var/www/vhost.example.com/index.php [OK]

Log Level 1

Existing:

127.0.0.1 - - [19/Nov/2009:14:41:25 --0500] [vhost.example.com/sid#8475130][rid#8681480/initial] (1) pass through /paul_reinheimer.png

Non-Existant:

127.0.0.1 - - [19/Nov/2009:14:42:55 --0500] [vhost.example.com/sid#8475130][rid#867d470/initial] (1) go-ahead with /var/www/vhost.example.com/index.php [OK]

Log Level 0

Existing:

}}}
=== Non-Existant ===
{{{

Both entries were intentionally, and correctly, left blank

  • No labels