Home All Groups Group Topic Archive Search About

write to application Event Viewer

Author
16 Jun 2006 6:19 AM
sk.rasheedfarhan
Hi All,

Please look in to this snippet.

string sEvtSource = "MSSQLSERVER";
int m_nEventID = 17055;
string sEvtLog = "Application";
if (!EventLog.SourceExists(sEvtSource))
      EventLog.CreateEventSource(sEvtSource,sEvtLog);
EventLog.WriteEntry(sEvtSource,"TESTMessage",EventLogEntryType.Information,m_nEventID);


Above I am Generating and writing an NT Event entry into the logviewer.
Here I am performing the action on event Source = MSSQLSERVER and its
EventID = 17055
So the issue is I am getting the Description of this Event as below:

"The description for Event ID ( 17055 ) in Source ( MSSQLSERVER )
cannot be found. The local computer may not have the necessary registry
information or message DLL files to display messages from a remote
computer. The following information is part of the event:
TESTMessage."

But if I want to get the description which will contain only the actual
event description of event 17055 what should I do?

You can please view the actual description of the event no 17055 by
restarting the MS SQL Server service.

Regards,
Rasheed

Author
17 Jun 2006 1:45 AM
Peter Ritchie
Why in the world would you be writing event log entries on behalf of SQL Sever?

Are you creating the event source?

Show quote
"sk.rasheedfar***@gmail.com" wrote:

> Hi All,
>
> Please look in to this snippet.
>
> string sEvtSource = "MSSQLSERVER";
> int m_nEventID = 17055;
> string sEvtLog = "Application";
> if (!EventLog.SourceExists(sEvtSource))
>       EventLog.CreateEventSource(sEvtSource,sEvtLog);
> EventLog.WriteEntry(sEvtSource,"TESTMessage",EventLogEntryType.Information,m_nEventID);
>
>
> Above I am Generating and writing an NT Event entry into the logviewer.
> Here I am performing the action on event Source = MSSQLSERVER and its
> EventID = 17055
> So the issue is I am getting the Description of this Event as below:
>
> "The description for Event ID ( 17055 ) in Source ( MSSQLSERVER )
> cannot be found. The local computer may not have the necessary registry
> information or message DLL files to display messages from a remote
> computer. The following information is part of the event:
> TESTMessage."
>
> But if I want to get the description which will contain only the actual
> event description of event 17055 what should I do?
>
> You can please view the actual description of the event no 17055 by
> restarting the MS SQL Server service.
>
> Regards,
> Rasheed
>
>
Author
19 Jun 2006 5:58 AM
sk.rasheedfarhan
Hi Peter Ritchie,

     As per My Requirement I want all the Events Descriptions through
its EventID and Source(EventID and Source are External inputs), which
are under SQL Server2000. So

1) tell me when a event is generated how this event gather Event
Properties (Source,Eventid,Type,Category...etc). Through a sample code.
But as per my analysis i know it uses the Regedit information and a
EventMessageFile

2) to get this Event properties any API is present.

I am glad to be of 

Response,
Rasheed.

AddThis Social Bookmark Button