Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://neptun.sai.msu.su/manual/multilogs.html
Дата изменения: Mon Oct 15 20:35:56 2001 Дата индексирования: Mon Oct 1 19:43:47 2012 Кодировка: Поисковые слова: mercury surface |
TransferLog
or CustomLog
directive.
These directives can be repeated to create more than one log
file (in previous releases, only one logfile could be given per
server configuration). The TransferLog
directive
creates a log file in the standard "common log format",
although this can be customized with LogFormat
.
The syntax of these two directives is the same as for the
config log module in previous Apache releases.
The real power of multiple log files come from the ability to create log files in different formats. For example, as well as a CLF transfer log, the server could log the user agent of each client, or the referrer information, or any other aspect of the request, such as the language preferences of the user.
The new CustomLog
directive takes both a
filename to log to, and a log file format.
The first argument is the filename to log to. This is used
exactly like the argument to TransferLog
, that is,
it is either a file as a full path or relative to the current
server root, or |programname. Be aware that anyone who can
write to the directory where a log file is written can gain
access to the uid that starts the server. See the security tips document for
details.
The format argument specifies a format for each line of the
log file. The options available for the format are exactly the
same as for the argument of the LogFormat
directive. If the format includes any spaces (which it will do
in almost all cases) it should be enclosed in double
quotes.
TransferLog
or CustomLog
directives,
the logs defined for the main server will be used. If it does
contain one or more of these directives, requests serviced by
this virtual host will only be logged in the log files defined
within its definition, not in any of the main server's log
files. See the examples below.
TransferLog logs/access_log CustomLog logs/agents "%{user-agent}i"To define a CLF transfer log and a referrer log which log all accesses to both the main server and a virtual host:
TransferLog logs/access_log CustomLog logs/referer "%{referer}i" <VirtualHost> DocumentRoot /whatever ServerName my.virtual.host </VirtualHost>Since no TransferLog or CustomLog directives appear inside the <VirtualHost> section, any requests for this virtual host will be logged in the main server's log files. If however the directive
TransferLog logs/vhost_access_logwas added inside the virtual host definition, then accesses to this virtual host will be logged in vhost_access_log file (in common log format), and not in logs/access_log or logs/referer.