Log Files

The server tracks its activity using two log files. The transfer log keeps track of all incoming requests, while the server log stores server and servlet status messages.

The server log is utilized from your own servlets via its ServletContext object. Please consult the servlet documentation for more details. Additionally, the LogViewer example servlet demonstrates how to read the log files from within a servlet.

Log File Location

It is recommended that the log files be stored in a ramdisk to minimize wear on the flash. Please consult the "Information about the flash" section of the FAQ in the SNAP documentation for more details.

Transfer Log Format

The transfer log is stored in the Extended Common Log Format. Each line of the log contains the following information:

remotehost Address of the client that made the request. For performance reasons, the server does not look up the host name.
rfc931 The remote login name of the user. This will be a single "-".
authuser This will be the name that the user used to authenticate himself, if requesting a protected page.
[date] The date and time of the request.
"request" The exact request line from the client.
status This will be the HTTP status code sent by the server
bytes The number of bytes sent to the client.
"referer" The URL the client was viewing before making the current request. (Note that the spelling of "referer" is an unfortunate mistake in the HTTP specification.)
"user_agent" The user agent the client claims to be using.

There will be a "-" in each entry that is not known, or cannot be determined, by the server.

Here is an example of an entry in the transfer log (note that the line may be wrapped, but should be on one line):

192.168.0.2 - test [Tue, 07 Oct 2003 02:52:04 CST] "GET /servlet/AuthExample HTTP/1.1" 200 - "http://192.168.0.4/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)"

http://www.bacuslabs.com/WsvlCLF.html has another description of this format.

Server Log

Each line of the server log will contain a date and a message. Some messages may include exceptions with a message, while some will just contain descriptive text. For example (note that some lines may be wrapped, but should be on one line):

[Mon, 13 Oct 2003 17:08:58 CST]Server started on port 80
[Mon, 13 Oct 2003 17:10:42 CST]java.io.IOException: Error in write

Log Configuration

The log files are configured using the logging properties in the server properties file. It is possible to configure the log file locations, their maximum size, and where they will get emailed when full.