dcsimg

Apache Guide: Logging, Part 2 -- Error Logs

By Rich Bowen (Send Email)
Posted Aug 28, 2000


Last week, O gentle reader, we talked about the Apache access log, and what the information in there means. This week, we're going to talk about the other standard log file: the error log.

Not all log files are the same. In this article, Rich Bowen looks at error log files, which can provide valuable information when your Apache Web server misbehaves.

As you'll see in coming weeks, these two logs are generated by different processes. And you'll see in this article that the format of the entries in the error log are rather different from the entries in the access log that we saw last week.

But the two logs are similar, in that they both provide a lot of useful information which you can use in analyzing how your server is being used, and what is going wrong.

Where's the File?

Your error log file should be in the same location as your access log file. It will be called error_log, or, on Windows machines, error.log.

The location of your error log can be configured with the ErrorLog directive:

        ErrorLog logs/error.log

The location, unless it has a leading slash, is assumed to be relative to the ServerRoot location.

In a default Apache installation, the log file is located in /usr/local/apache/logs As before, if you installed with one of the various package managers out there, you may find it just about anywhere.

What's in It?

The error log, as the name suggests, contains a record of everything that went wrong while your server was running. It also contains general diagnostic messages, such as a notification of when your server was restarted, or shut down.

You can set your log level higher or lower to control the amount, and type, of messages that appear in your log file. This is configured with the LogLevel directive. The default setting of this directive is error, which tells you about error conditions. For a full listing of the different things you can set it to, see the Apache documentation at http://www.apache.org/docs/mod/core.html#loglevel

In most cases, the things that you see in your log file will be in two categories: document errors and CGI errors. You will also occasionally see configuration errors, and, as I mentioned above, server start and server stop messages.

Document Errors

Document errors are things that are in the 400 series of server response codes. The most common of these is 404 - Document Not Found. 404's are followed by, at least on my server, authentication errors.

A 404 error occurs whenever someone requests a resource--a URL - that is not on your server. Either they have mistyped something, or there was a typo'ed link somewhere, or you moved or deleted a document that used to be on your server.

Incidentally, Jakob Nielson says that you should never move or delete any resource from your website without providing a redirect or some variety. If you're not already familiar with Nielson's writings, you should take a look sometime. http://www.zdnet.com/devhead/alertbox/

When a client is unable to locate a document on your server, you'll see an entry like this in your logs:


        [Fri Aug 18 22:36:26 2000] [error] [client 192.168.1.6] File does not exist: 
        /usr/local/apache/bugletdocs/Img/south-korea.gif

Note that, as in the case of the access_log file, this record is broken down into several fields.

Page 1 of 3


Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.