ellisd5
12-13-2004, 05:52 PM
I've written this function but it doesn't work :confused:
With this code not in a Function but directly in a asp page it works, however if I call it in my asp page using logger("My message") it fails.
Im pretty new to ASP and noticed in the other couple of functions I always set the function to return a value, do I need to do this? I don't want it to return anything, i just want it to write to the log.
Function logger(logMessage)
'' Enter login into log
Dim objFSO, filename
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
filename = Server.MapPath(".") & "\logs\logBook.log"
Dim objTextStream
Set objTextStream = objFSO.OpenTextFile(filename, 8)
objTextStream.WriteLine(now & " - " & logMessage)
objTextStream.Close
Set objTextStream = Nothing
Set objFSO = Nothing
End Function
With this code not in a Function but directly in a asp page it works, however if I call it in my asp page using logger("My message") it fails.
Im pretty new to ASP and noticed in the other couple of functions I always set the function to return a value, do I need to do this? I don't want it to return anything, i just want it to write to the log.
Function logger(logMessage)
'' Enter login into log
Dim objFSO, filename
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
filename = Server.MapPath(".") & "\logs\logBook.log"
Dim objTextStream
Set objTextStream = objFSO.OpenTextFile(filename, 8)
objTextStream.WriteLine(now & " - " & logMessage)
objTextStream.Close
Set objTextStream = Nothing
Set objFSO = Nothing
End Function