Table of Contents

OIL2 Class Standard.HTTPextendedLogFormat


class Standard . HTTPextendedLogFormat {
        set     fieldNames;
        oid     fileObj;
        string  fileSpec;
        int32   outputHeader;
        string  serviceName;
        oid     serviceOID;
inherits from Object;

DESCRIPTION

The HTTPextendedLogFormat class implements a logging service for the HTTPdaemon that records access activity. It registers itself as the service named HTTPlogger:websiteName; it defaults to HTTPlogger:localhost. See reference: http://www.w3.org/TR/WD-logfile.html.

A slightly simplified logging interface is provided by the class HTTPcommonLogFormat.

METHODS


Standard.HTTPextendedLogFormat:create

HTTPextendedLogFormat:create(string fileName, string servName)

Method Description

See initialize.


Standard.HTTPextendedLogFormat:initialize

HTTPextendedLogFormat:initialize(string fileName, string servName)

Method Description

The initialize method usually takes at least 3 arguments. The first is a fileName to which access log records should be appended. If specified as the null string or "-", no log file is opened. The second argument specifies the name of the web server (corrresponding to the ServerName parameter in the profile read by HTTPdaemon) to which this logging object should be associated. To construct the name of the logging service, the value provided is appended to the prefix "HTTPlogger:".

The third and any remaining arguments identify the names of fields to be written to the each line of the log file. Any undefined values will be written as "-".

The naming conventions are defined in the Extended Log File specification referenced above. The list of current recognized attributes is provided below.

commonLogDate
an implementation-specific extension that outputs the date/time in the old format used by the common log format.
ident
an implementation-specific extension that outputs the user info obtained from ident.
user
an implementation-specific extension that outputs the user identity.
date
the request date in YYYY-MM-DD format.
time
the request date in HH:MM:SS.
time-taken
the elapsed time of the request in seconds.
bytes
the number of the bytes request.
cached
a Boolean indication if the data was cached.
sc-status
the HTTP status code returned to the client (e.g., 200, 404, etc.)
sc-comment
a textual description of the status code (e.g., OK, Not Found, etc.)
c-ip
the IP address of the client
c-dns
the resolved hostname of the client (not yet implemented)
cs-method
the method used to make the query (e.g., GET, PUT, POST, etc.)
cs-uri
the complete URI requested.
cs-proto
an implementation-specific extension that indicates the protocol used by the client (typically, HTTP/1.0 or HTTP/1.1).
cs-uri-stem
the base part of the requested URI.
cs-uri-query
the query portion of the URI.
cs(HEADER-FIELD-NAME)
outputs the value of the corresponding HTTP header provided in the client's request. For example, cs(referer) outputs the "Referer:" field.


Standard.HTTPextendedLogFormat:reopen

HTTPextendedLogFormat:reopen(optional string newFileName)

Method Description

The reopen method requests that the current log file be closed and then reopened. This is typically invoked by a remote application during log file rotation: the current log file is renamed, then a reopen request is invoked, which causes the current log file to be closed and a new one to be created. If the optional argument newFileName is provided, it is set as the name of the new log file. If newFileName is specified as the null string or "-", then a new log file is not opened.

Return Value

If fromObject is not nil, then a value indicating the success of the request is returned. A value of 0 indicates that the request was performed; a value of -1 indicates that a reopen was attempted but no log file was active and no new file name was provided.


Standard.HTTPextendedLogFormat:logFileOpened

HTTPextendedLogFormat:logFileOpened(oid fileObject)

Method Description

The logFileOpened method is called each time a log file is opened. Subclasses can override this default implementation to extend or inhibit the implementation provided here.

The extended log format specification requires that a log file begin with two lines that the specify the version and fields provided in the log. The logFileOpened method writes this required data to the log file each time it is opened.


Standard.HTTPextendedLogFormat:logFileClosed

HTTPextendedLogFormat:logFileClosed(oid fileObject)

Method Description

The logFileClosed method is called each time a log file is closed. Subclasses can override this default implementation to extend or inhibit the implementation provided here.

The logFileClosed method writes an "End-Date" directive to the log file each time it is closed.


Standard.HTTPextendedLogFormat:logRequest

HTTPextendedLogFormat:logRequest(string fromAddr, int32 localTime, array header, assoc options, int32 statusCode, int32 bytesSent, string reasonPhrase)

Method Description

Objects of HTTPfastReceive send logRequest messages to the logging service associated with their corresponding web site (which is represented by a URLdirectory object).

Return Value

This method returns no value.