Debugging with PHP Access logs
The PHP access logs have been customised to include additional MageStack information for debugging.
A typical access log entry will look like this,
- - 10/Jul/2014:22:27:49 +0100 "GET /index.php" 200
The default format is "%R - %u %t "%m %r" %s"
Decompiling the log entry reveals,
Column | Value | Field |
---|---|---|
1 | - | Remote IP Address |
2 | - | Remote User |
3 | 10/Jul/2014:22:27:49 +0100 | Server Time |
4 | GET | Request Method |
5 | /index.php | Request URI (without query string) |
6 | 200 | Response Code (status) |
The full, available options for formatting are:
%C: %CPU used by the request
it can accept the following format:
- %{user}C for user CPU only
- %{system}C for system CPU only
- %{total}C for user + system CPU (default)
%d: time taken to serve the request
it can accept the following format:
- %{seconds}d (default)
- %{miliseconds}d
- %{mili}d
- %{microseconds}d
- %{micro}d
%e: an environment variable (same as $_ENV or $_SERVER)
it must be associated with embraces to specify the name of the env
variable. Some exemples:
- server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
- HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
%f: script filename
%l: content-length of the request (for POST request only)
%m: request method
%M: peak of memory allocated by PHP
it can accept the following format:
- %{bytes}M (default)
- %{kilobytes}M
- %{kilo}M
- %{megabytes}M
- %{mega}M
%n: pool name
%o: ouput header
it must be associated with embraces to specify the name of the header:
- %{Content-Type}o
- %{X-Powered-By}o
- %{Transfert-Encoding}o
- ....
%p: PID of the child that serviced the request
%P: PID of the parent of the child that serviced the request
%q: the query string
%Q: the '?' character if query string exists
%r: the request URI (without the query string, see %q and %Q)
%R: remote IP address
%s: status (response code)
%t: server time the request was received
it can accept a strftime(3) format:
%d/%b/%Y:%H:%M:%S %z (default)
%T: time the log has been written (the request has finished)
it can accept a strftime(3) format:
%d/%b/%Y:%H:%M:%S %z (default)
%u: remote user