Sunday, March 13, 2011

Writing Log in Classic ASP


'Global variable
Dim StrLogFile : StrLogFile = "log.txt"


'call this sub wherever required
sub WriteLog (msg)


Dim fso, fDebug
set fso = Server.CreateObject ("Scripting.FileSystemObject")
set fDebug = fso.OpenTextFile (StrLogFile , 8, True)
fDebug.WriteLine (FormatDateTime (Now) & " - " & msg)
fDebug.Close
set fDebug = nothing
set fso = nothing


end sub

No comments:

Post a Comment