6.2.11 Logging Utility component
The Logging Utility component is a new component of ASP 3.0 and provides methods for accessing log files. This log file is created by IIS supported by the server for Web and FTP websites.
1. Logging Utility component member
The Logging Utility component provides six methods to read the content of log files and write new records into existing log files. These methods are similar to the FileSystemObject object methods discussed in the previous chapter, as shown in Table 6-9:
Table 6-9 methods and descriptions of the Logging Utility component
Method
Description
AtEndOfLog ()
When you use the ReadLogRecord method to traverse records, if all records in the file have been read, the returned value is True.
CloseLogFiles (io_mode)
Close the opened log file. The value of io_mode specifies the file to be closed. The constant ForReading (1) indicates to close all open files for reading. ForWriting (2) indicates closing all open files for writing, and AllOpenFiles (32) indicates closing all opened files.
OpenLogFile (filename, io_mode,
Service_name, service_instance,
Output_format)
Open the log file or log file set specified by filename. The optional io_mode parameter can be set to ForReading (default value, 1) or ForWriting (2 ). When reading a specific IIS service (such as "W3SVC" and "1"), the optional service_name and service_instance parameters limit the records returned from the file. The optional output_format parameter specifies the format used for file writing.
ReadFilter (start, end)
When reading a file within the specified time range and date range, both parameters are optional. If this parameter is ignored, start is the first record of the file, and end is the last record.
ReadLogRecord ()
Read the next record from the current log file opened using the OpenLogFile method
WriteLogRecord (logging_object)
Write records to an open file for reading. The logging_object parameter is an object variable that references the instance of the Logging Utility component that saves source records.
The Logging Utility component provides 20 attributes that correspond to IIS log records, as shown in Table 6-10:
Table 6-10 attributes and descriptions of the Logging Utility component
Genus
Description
BytesReceived
Number of bytes received from the browser during request
BytesSent
Number of bytes sent to the browser in response
ClientIP
IP address of the client or its host (that is, the proxy server)
Cookie
Cookie content transmitted in the request
CustumFields
An array added to the custom header in the request
DataTime
Requested date and time (GMT)
Method
Operation type, such as "Get" and "Post"
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service