Logge ASP fejl
Hej,Før i tiden loggede jeg evt. ASP-fejl med functionen her:
Og jeg syntes at det var dejligt nemt og overskueligt.
Men hvordan gør jeg det på windows server 2008 r2
Selv om jeg sætter den til 'custom error pages' og 'Type' til execute url til ASp-filen med min function logger den ikke ret meget, ja stort set intet.
Ellers skal jeg rode rundt i de fejl logs iis laver som jeg syntes giver mig menge flere info end jeg har brug for og at det derfor tager noget længere tid end min gamle metode.
Function LogErrorToFile ()
Dim objFS
Dim objFile
On Error Resume Next
LogError = False
Set objFS = Server.CreateObject ("Scripting.FileSystemObject")
If Err.number = 0 Then
Set objFile = objFS.OpenTextFile (mstrFileName, 8, True)
If Err.number = 0 Then
objFile.WriteLine "------------------------------------------------------"
objFile.WriteLine "* Error At " & Now
objFile.WriteLine "* CustomerRefID " & mstrCustRefID
objFile.WriteLine "* Session ID " & Session.SessionID
objFile.WriteLine "* RequestMethod " & Request.ServerVariables("REQUEST_METHOD")
objFile.WriteLine "* ServerPort " & Request.ServerVariables("SERVER_PORT")
objFile.WriteLine "* HTTPS " & Request.ServerVariables("HTTPS")
objFile.WriteLine "* LocalAddr " & Request.ServerVariables("LOCAL_ADDR")
objFile.WriteLine "* HostAddress " & Request.ServerVariables("REMOTE_ADDR")
objFile.WriteLine "* UserAgent " & Request.ServerVariables("HTTP_USER_AGENT")
objFile.WriteLine "* URL " & Request.ServerVariables("URL")
If ASPErr.ASPCode <> "" Then objFile.WriteLine "* Error #: " & ASPErr.ASPCode
If ASPErr.Number <> 0 Then objFile.WriteLine "* COM Error #: " & ASPErr.Number & " (" & Hex (ASPErr.Number) & ")"
If ASPErr.Source <> "" Then objFile.WriteLine "* Source: " & ASPErr.Source
If ASPErr.Category <> "" Then objFile.WriteLine "* Category: " & ASPErr.Category
If ASPErr.File <> "" Then objFile.WriteLine "* File: " & "//" & Request.ServerVariables ("SERVER_NAME") & ASPErr.File
'Response.Write ASPErr.ASP_LOG_ERROR
objFile.WriteLine "* String: " & Request.ServerVariables ("QUERY_STRING")
If ASPErr.Line <> 0 Then objFile.WriteLine "* Line, Column:" & ASPErr.Line & ", " & ASPErr.Column
If ASPErr.Description <> "" Then objFile.WriteLine "* Description: " & ASPErr.Description
If ASPErr.ASPDescription <> "" Then objFile.WriteLine "* ASP Desc: " & ASPErr.ASPDescription
objFile.WriteLine "* FormData " & Request.Form
objFile.WriteLine "* HTTP Headers: "
objFile.WriteLine "*****************************"
objFile.WriteLine Replace(Request.ServerVariables("ALL_HTTP"),vbLf,vbCrLf)
objFile.WriteLine "*****************************"
objFile.WriteLine "------------------------------------------------------" & vbCrLf
objFile.Close
End If
End If
End Function