Previous Next

Thread: Problem in writing Event log from ISAPI Filter

Last post 06-11-2008 1:23 AM by muhammadasimsajjad. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 06-10-2008, 3:32 AM

    Problem in writing Event log from ISAPI Filter

    Hi

    My problem is that i want to write the ISAPI log in Event Viewer. i have written ISAPI in VC++ 6.0. In some cases i am getting hang problem so that i want to see the log where i am getting error. If u can send me code it is more helpfull for me.

    Please help me if u can

    thanks in advance

     

  • 06-10-2008, 10:02 PM In reply to

    Re: Problem in writing Event log from ISAPI Filter

    This might help:

    CIsapiExtension::SetCriticalIsapiError
    http://msdn.microsoft.com/en-us/library/x0by16f1(VS.71).aspx

    From above:

    dwErr The error that occurred. This value can also be the ID of a string resource containing a plain text description of the error that can be used in the Windows Event Log and returned as part of an HTTP response

    HOWTO: ISAPI Filter which Logs original Client IP for Load Balanced IIS Servers
    http://blogs.msdn.com/david.wang/archive/2005/09/28/HOWTO-ISAPI-Filter-which-Logs-original-Client-IP-for-Load-Balanced-IIS-Servers.aspx

    HOWTO: Retrieve and Interpret ISAPI Filter Status

    HTH.

    ~ Ganesh

    Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
  • 06-11-2008, 1:23 AM In reply to

    Re: Problem in writing Event log from ISAPI Filter

    thanks Ganesh

    I resolved my problem using following. Following code write the logs sucessfully in Event log Viewer.

     int grades [] =
     {
      EVENTLOG_SUCCESS,
       EVENTLOG_INFORMATION_TYPE,
       EVENTLOG_WARNING_TYPE,
       EVENTLOG_ERROR_TYPE,
     };
     
     // Use event logging to log the error.
     //
     static HANDLE  hEventSource = NULL;
     if ( hEventSource == NULL ) hEventSource = RegisterEventSource(NULL, TEXT("Agrando_ISAPI"));
     LPTSTR  lpszStrings[1];
     lpszStrings[0] = "My test Message to check in  Event Viewer";  
     if (hEventSource != NULL) {
      bool a = ReportEvent(hEventSource, // handle of event source
       grades[0],  // event type
       0,                    // event category
       1,                    // event ID
       NULL,                 // current user's SID
       1,                    // strings in lpszStrings
       0,                    // no bytes of raw data
       (const char**)lpszStrings,          // array of error strings
       NULL);                // no raw data
      

      //(VOID) DeregisterEventSource(hEventSource);
     }

Page 1 of 1 (3 items)
Page view counter