473,387 Members | 1,313 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

EventLog.Source & Service Programs

MAL
Hello,

I am writing a service program that writes to a custom EventLog. I
would like the two classes used in the service to write messages to
the same log ideally using a different Source name for filtering etc.

So far I am having little luck. I feel that I have been through the
documentation extensively but am chasing my tail. It seems like it
should be as simple as .CreateEventSource in each class I want to
write to the custom log, but to no avail.

When I tried to just add one class to the service program, the service
program wrote to the Application Log and the class wrote to the custom
one, even though the service seemed to have created the log. (Based on
a 5 minute timer before "Newing" my class) (.AutoLog = False) The code
is straight from the service program and EventLog walkthroughs (which
I end up using to clean things up (RemoveSource(s), DeleteLog) before
my next service removal and reboot.

The last thing I tried was creating a seperate EventLog in each class
and trying to associate the source with the log the service created. I
have attemted to pass a reference to the EventLog to the classes and
then change the source like in the multithreaded examples. I have
tried to bring the service pgms EventLog into scope in the classes.
AHHHHHHH!!!

I am obviously making this harder that it needs to be.

Thanks for reading this rant. Please advise.
Nov 20 '05 #1
1 1644
In your OnStart function:

Dim log As EventLog

If Not EventLog.SourceExists("ServiceSourceNameOfYourChoi ce") Then
EventLog.CreateSource("ServiceSourceNameOfYourChoi ce")
End If
log = New EventLog("Application", "ServiceSourceNameOfYourChoice")

HTH

David Williams [VB.NET MVP]

"MAL" <ir*************@hotmail.com> wrote in message
news:a2*************************@posting.google.co m:
Hello,

I am writing a service program that writes to a custom EventLog. I
would like the two classes used in the service to write messages to
the same log ideally using a different Source name for filtering etc.

So far I am having little luck. I feel that I have been through the
documentation extensively but am chasing my tail. It seems like it
should be as simple as .CreateEventSource in each class I want to
write to the custom log, but to no avail.

When I tried to just add one class to the service program, the service
program wrote to the Application Log and the class wrote to the custom
one, even though the service seemed to have created the log. (Based on
a 5 minute timer before "Newing" my class) (.AutoLog = False) The code
is straight from the service program and EventLog walkthroughs (which
I end up using to clean things up (RemoveSource(s), DeleteLog) before
my next service removal and reboot.

The last thing I tried was creating a seperate EventLog in each class
and trying to associate the source with the log the service created. I
have attemted to pass a reference to the EventLog to the classes and
then change the source like in the multithreaded examples. I have
tried to bring the service pgms EventLog into scope in the classes.
AHHHHHHH!!!

I am obviously making this harder that it needs to be.

Thanks for reading this rant. Please advise.


Nov 20 '05 #2

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

Similar topics

1
by: José Joye | last post by:
I know, this kind of question has already been asked. However, I could not find an answer related to the minimal privilege required to be able to create a new event Source in the appplication event...
5
by: timb | last post by:
Hi, am creating a windows service using c# and would like it to create a new eventlog logtype and add it to the eventlog viewer so that i can log all messages relating to this application to this...
2
by: Next | last post by:
Hello all, I have a windows service that was suppose to write some events into its own EventLog. I created the EventLog using the component on VS 2003 toolbar Added an installer for it. Set...
1
by: McKool | last post by:
Hello. I'm making a Windows service with C#. This service connect a comm Port when start and disconnect it when stop. I use an EventLog class to write information about this service, by...
3
by: John Lee | last post by:
Hi, we have been trying so many days and could not figure it out - please help!!! in windows 2003, we created an application pool and assigned a domain account as its identity - we also...
6
by: Microsoft | last post by:
I'm creating a windows service with C#, but am having a huge amount of difficulties using the event log. In the design view of the service, I drop an EventLog component. I name the source the...
2
by: John Smith | last post by:
I have created a windows service that logs errors to the EventLog. I want the logs to go to an EventLog I have created. However, I am finding that the event is not logging to the created EventLog...
0
by: pbh | last post by:
Hi all I've written a Service application and it must use it's own EventLog. The Service is checking if it is registered as EventLog source, and if not it creates it's own EventLog. Unfortunately...
0
by: Marcus Müller | last post by:
Hi, I'm using an user defined EventLog called "Fist Full of Lasers" within a C# service. The Log is created during the installation of the service in which the first entry of the log is written...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.