Logging Methods in ASP

Source: Internet
Author: User
Tags servervariables

<%
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

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.