The following VBscript extract provides a function that writes a single line to a log file (stored at c:\elink\log.txt” on the server). If the log file already exists, data is appended to the end of the log.
function append_log(log)
dim fso, tso
dim logfile
const ForReading = 1
const ForWriting = 2
const ForAppending = 8
On Error Resume Next
set fso = CreateObject(“Scripting.FileSystemObject”)
set logfile = fso.OpenTextFile(“c:\elink\log.txt”,ForAppending,0)
if Err.Number <> 0 then
On Error Goto 0
set logfile = fso.CreateTextFile(“c:\elink\log.txt”,0)
end if
logfile.WriteLine(log)
logfile.Close()
On Error Goto 0
end Function
Please find attached a full example of this function in action




