Chapter 11. Logging

There are two main aspects to logging: recording information about errors and other significant events, and tracking accesses to the web pages served. Other types of log information are more specialized, such as scripting, rewriting, and SSL.

On a busy server, log files grow rapidly and can be rotated in the following ways. You can either rename the current files and restart Apache so that it creates new files. Or you can pipe the log output through an external program that manages log rotation, such as the rotatelogs program included in the standard distribution or cronolog (http://cronolog.org/)—a popular, more sophisticated alternative.

Error Logging

Errors and other conditions are recorded to the error log, support for which is provided by the core. The mod_dumpio module adds the facility to record the data received and transmitted by Apache to the error log, which is useful for debugging.

ErrorLog

SV

core

logs/error_log

ErrorLog { filename | "|command" | syslog[:facility] }

Specifies the file for logging error messages. If the argument starts with a pipe character (|), then it is taken as an executable file that is spawned and passed error messages on its standard input.

LogLevel

SV

core

error

LogLevel level

Controls the verbosity of error logging. Messages will only be logged that are of a severity of level or higher. The log levels are listed in Table 11-1 in descending order of severity.

Table 11-1. Error log levels

Level

Description

emerg

Emergency conditions signifying ...

Get Apache 2 Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.