## CustomLog

Syntax: CustomLog file-pipe format-or-nickname env=[!]environment-variable
Context: server config, virtual host
Status: Base
Compatibility: Only available in Apache 1.3.5 or later
Module: mod_log_config

The behaviour of this form of the `CustomLog` directive is almost identical to the standard `CustomLog` directive. The difference is that the '`env=`' clause controls whether a particular request will be logged in the specified file or not. If the specified environment variable is set for the request (or is not set, in the case of a '`env=!name`' clause), then the request will be logged.

Environment variables can be set on a per-request basis using the mod_setenvif and/or mod_rewrite modules. For example, if you don't want to record requests for all GIF images on your server in a separate logfile but not your main log, you can use:

        SetEnvIf Request_URI \.gif$ gif-image
        CustomLog gif-requests.log common env=gif-image
        CustomLog nongif-requests.log common env=!gif-image