write to application Event Viewer

S

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
 
G

Guest

Why in the world would you be writing event log entries on behalf of SQL Sever?

Are you creating the event source?
 
S

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top