WriteLog Statement:

The WriteLog statement writes a line of text into a log file. The WriteLog statement automatically inserts the date and time of the log addition along with any text you specify in the logevent argument. WriteLog automatically appends new information to any existing data in a log file if one is found. If the specified log file is not found, it is created for that entry.

Syntax:
WriteLog pathname, logevent
Example Usage:
<% 
Dim strErrEvent

On Error Resume Next
	... some code or event that may fail due to an error
If Err Then
	 ' in the event of an error, write the page path, 
	 ' error number and error description to the log file...
	strErrEvent =	Request.ServerVariables("PATH_INFO") & vbTab & _
				Err.Number & vbTab & Err.Description
	WriteLog Server.Mappath("/website_errors.txt"), strErrEvent
End If
On Error GoTo 0
%>
ASP Source Code:
<%
Private Sub WriteLog(byVal pathname, byVal logevent)
	Dim objFSO, objFile
	Set objFSO  = Server.CreateObject("Scripting.FileSystemObject")
	Set objFile = objFSO.OpenTextFile(pathname, 8, True)
	objFile.WriteLine Now() & vbTab & logevent
	objFile.Close
	Set objFile = Nothing
	Set objFSO  = Nothing
End Sub
%>