473,473 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

write to application event viewer

Hi all,

According to my project requirement I have to write the NT Event
information of SQL Server into EventLog viewer.
For more clear I want to write the following information into
Application log file:
---------------------------------------------------------------------------*---------------------------

Event ID :17055
Source :MSSQLServer
Date : xx-xx-xx
Time :xx-xx-xx
User :xxxxxx
Category :xxx
Computer :xxxx
Type :Information
Description:
17148 :
SQL Server is terminating due to 'stop' request from Service Control
Manager.
---------------------------------------------------------------------------*---------------------------

Through code I have to enter the above information into Application
Event Log. So I am able to write any event from "EventLog class"
through C#. But the event generated is not having the proper
description. It is having the following description:
[General one not specific to any eventid and source]
Source : Application
EventID : 0
Description :
The description for Event ID ( 0 ) in Source ( Application ) 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: Writing to
event log.
My Major Problem:
If I given EventID = 17055 and Source = MSSQLSERVER so how can I write
the above log information in the Event Log.And also, is it possible to

retrieve the description of the NT event from the EventMessageDLL?
Let me know ASAP.
Hope someone can help.
Sincerely
Rasheed.

Jun 15 '06 #1
3 18483
You need to register your event source first:
sEvtSource = "MyAppl";
if (!EventLog.SourceExists(sEvtSource))
EventLog.CreateEventSource(sEvtSource,sEvtLog);
EventLog.WriteEntry(sEvtSource,"A test
event",EventLogEntryType.Information,2001);

Hope this helps
--
Steve Smith
Victoria BC Canada
"sk**************@gmail.com" wrote:
Hi all,

According to my project requirement I have to write the NT Event
information of SQL Server into EventLog viewer.
For more clear I want to write the following information into
Application log file:
---------------------------------------------------------------------------Â*---------------------------

Event ID :17055
Source :MSSQLServer
Date : xx-xx-xx
Time :xx-xx-xx
User :xxxxxx
Category :xxx
Computer :xxxx
Type :Information
Description:
17148 :
SQL Server is terminating due to 'stop' request from Service Control
Manager.
---------------------------------------------------------------------------Â*---------------------------

Through code I have to enter the above information into Application
Event Log. So I am able to write any event from "EventLog class"
through C#. But the event generated is not having the proper
description. It is having the following description:
[General one not specific to any eventid and source]
Source : Application
EventID : 0
Description :
The description for Event ID ( 0 ) in Source ( Application ) 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: Writing to
event log.
My Major Problem:
If I given EventID = 17055 and Source = MSSQLSERVER so how can I write
the above log information in the Event Log.And also, is it possible to

retrieve the description of the NT event from the EventMessageDLL?
Let me know ASAP.
Hope someone can help.
Sincerely
Rasheed.

Jun 15 '06 #2

sk**************@gmail.com wrote:
<snip>
My Major Problem:
If I given EventID = 17055 and Source = MSSQLSERVER so how can I write
the above log information in the Event Log.And also, is it possible to

retrieve the description of the NT event from the EventMessageDLL?

<snip>

I might be misunderstanding your intent, but it sounds very much like
you want to write a "SQL Server stopped" event to the event log with a
source value of MSSQLSERVER. This is a *very* bad idea for the
following reasons:

1) This information is already logged by SQL Server.
2) Your app would effectively be masquerading as SQL Server.

Cheers,

Dave Boyle

Jun 15 '06 #3
Take a look:
http://msdn2.microsoft.com/en-us/lib...og(d=ide).aspx

chanmm

<sk**************@gmail.com> wrote in message
news:11**********************@r2g2000cwb.googlegro ups.com...
Hi all,

According to my project requirement I have to write the NT Event
information of SQL Server into EventLog viewer.
For more clear I want to write the following information into
Application log file:
---------------------------------------------------------------------------*---------------------------

Event ID :17055
Source :MSSQLServer
Date : xx-xx-xx
Time :xx-xx-xx
User :xxxxxx
Category :xxx
Computer :xxxx
Type :Information
Description:
17148 :
SQL Server is terminating due to 'stop' request from Service Control
Manager.
---------------------------------------------------------------------------*---------------------------

Through code I have to enter the above information into Application
Event Log. So I am able to write any event from "EventLog class"
through C#. But the event generated is not having the proper
description. It is having the following description:
[General one not specific to any eventid and source]
Source : Application
EventID : 0
Description :
The description for Event ID ( 0 ) in Source ( Application ) 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: Writing to
event log.
My Major Problem:
If I given EventID = 17055 and Source = MSSQLSERVER so how can I write
the above log information in the Event Log.And also, is it possible to

retrieve the description of the NT event from the EventMessageDLL?
Let me know ASAP.
Hope someone can help.
Sincerely
Rasheed.
Jun 15 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: FrodoBaggins | last post by:
Dear Team, I am running Visual Studio 2003 Version 7.1.3088 on Windows Server 2003. I have written a C# application that must write to the event log. When it attempts to write to the event log,...
2
by: Andy Fish | last post by:
Hi, I am wanting to put some simple logging into my .net app. The basic features will be that errors get logged to a file and that there will be a configuration flag to enable more detailed...
2
by: Angelos Karantzalis | last post by:
Hi, can anybody point me to some info in how to write to the event viewer ? I've build a COM+ component, and I have no real way to get information on the possible exceptions that occur during...
9
by: Steve Buster | last post by:
All right, I have read every forum, newsgroup etc about this issue and no one seems to know how to fix it. I am getting a "Server Application Unavailable" exception running my .NET 1.1...
0
by: cherryparadise001 | last post by:
Hi All, I have moved an asp system from Window Server 2000 to Window Server 2003 recently. Many error occured and most of them are unable to get the control's value in the page. I am newbie to...
0
by: sk.rasheedfarhan | last post by:
Hi all, According to my project requirement I have to write the NT Event information of SQL Server into EventLog viewer. For more clear I want to write the following information into...
0
by: Eniac | last post by:
Hello, I've started using Enterprise Library 2.0 recently and I've encountered a problem that seems to be ... well... undocumented :) Basically, when I set a Trace Listener (formatted event...
0
by: edwardsurjadi | last post by:
guys, i have ASP.NET website(UI) that connect to BusinessLogic(Console Application hosting the BL) through .NET Remoting on different computer. What amussing is, sometimes (very rare), the BL...
1
by: zman77 | last post by:
Hi. I have a windows service that I wrote in C#. After I successfully compile it, I install it using InstallUtil, then run it with the net start command. I am trying to either log some stuff to a...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.