Explanation: The TransferLog and CustomLog directives are both used to specify the location and format of the access log file in Apache HTTPD. The access log file records information about each request received by the server, such as the client IP address, the request method, the requested URL, the response status code, and the bytes sent.
The TransferLog directive is a simple way to enable access logging, without any customization. It takes one argument, which is the name of the log file or a pipe to a program that will handle the log data. For example:
TransferLog logs/access_log
The CustomLog directive is a more flexible way to enable access logging, with the ability to customize the log format and conditionally log requests based on environment variables. It takes two or three arguments, which are the name of the log file or a pipe to a program, the log format string or a nickname defined by the LogFormat directive, and optionally an expression that evaluates to true or false for each request. For example:
CustomLog logs/access_log common CustomLog “|/usr/bin/rotatelogs logs/access_log.%Y-%m-%d 86400” combined CustomLog logs/ssl_access_log “%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x "%r" %b” env=HTTPS
The ErrorLog directive is another logging directive in Apache HTTPD, but it is used to specify the location and format of the error log file, which records any errors or warnings encountered by the server. For example:
ErrorLog logs/error_log
The ServerLog and VHostLog directives are not valid logging directives in Apache HTTPD. They may be confused with the ServerSignature and VirtualHost directives, which are used for other purposes.
References:
- Log Files - Apache HTTP Server Version 2.4
- Directive Index - Apache HTTP Server Version 2.4
- Apache Logging Basics - The Ultimate Guide To Logging