<%
Function GetPath ()
GetPath = Request.ServerVariables ("Appl_physical_path")
End Function
Function Getscriptname ()
SName = Request.ServerVariables ("Script_name")
Getscriptname = SName
End Function
Sub Writelog (logmsg, strSQL)
F_yy=cstr (now ())
If (Month (now ()) < ten) Then
f_mm= "0" & CStr (Month (now ()))
Else
F_mm=cstr (Month (now ()))
End if
If (Today ()) <) Then
F_dd= "0" & CStr (Day (now))
Else
F_dd=cstr (Day ())
End if
' F_date = FormatDateTime (date,2)
f_date1 = f_yy & f_mm & F_DD
pathname = "D:\LOG\" & Request.ServerVariables ("REMOTE_ADDR") & "-" & F_date1 & ". LOG" ' FormatDateTime (Date, 1) FormatDateTime (Now (), 1)
Set fso = server. CreateObject ("Scripting.FileSystemObject")
If Fso.fileexists (pathname) Then
Set ofile = FSO. OpenTextFile (Pathname,8,true)
Else
Set ofile = FSO. CreateTextFile (Pathname,true)
End If
Ofile. Writeline "[" & Now & "-" & Getscriptname () & "]" & Chr (All) & Chr (10)
Ofile. Writeline logmsg & chr & Chr (10)
Ofile. Writeline strSQL & chr & Chr (10)
Ofile.close
Set ofile = Nothing
Set fso = Nothing
End Sub
%>
Logging methods in ASP