473,414 Members | 1,700 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,414 software developers and data experts.

Should a window service use its own evenl log?

Hi,

I am writing a window service and I wonder should I use my own event log
or should I use one of the predefined event logs?

Thanks in advance
Nov 16 '05 #1
5 2645
I always find it more convenient to write to my own even log, it keeps it in
seperate from other system event logs and gives you the flexibility to write
the information you want to see in there. If you design it properly, you
can always change you logging code later to log to a database for example.

"Julia" <co********@012.net.il> wrote in message
news:O9*************@TK2MSFTNGP14.phx.gbl...
Hi,

I am writing a window service and I wonder should I use my own event log
or should I use one of the predefined event logs?

Thanks in advance

Nov 16 '05 #2
Hi Julia,

I think that it entirely depends on what you are logging. If it is a
minimal amount of information that you are logging (e.g. Service x started,
Service x error..,etc) and the information fits one of the existing logs I
believe that using an existing log would be fine. If you are logging an
extensive amount of information that would clutter the existing logs or
doesn't match the content I believe that it would be best to go with your own
log. Just my opinion.

Hope this helps.
-------------------
Nov 16 '05 #3
Yes, i am thinking to log to the event log only "Service X
started\stopped.",
error and exceptions
and other stuff will goes to a log file

Thanks.

"Brian Brown" <Br********@discussions.microsoft.com> wrote in message
news:8B**********************************@microsof t.com...
Hi Julia,

I think that it entirely depends on what you are logging. If it is a
minimal amount of information that you are logging (e.g. Service x started, Service x error..,etc) and the information fits one of the existing logs I
believe that using an existing log would be fine. If you are logging an
extensive amount of information that would clutter the existing logs or
doesn't match the content I believe that it would be best to go with your own log. Just my opinion.

Hope this helps.
-------------------

Nov 16 '05 #4
when a windows service starts or stops it is automatically logged to the
'System' event log.

HTH

Ollie Riches

"Julia" <co********@012.net.il> wrote in message
news:uS**************@TK2MSFTNGP11.phx.gbl...
Yes, i am thinking to log to the event log only "Service X
started\stopped.",
error and exceptions
and other stuff will goes to a log file

Thanks.

"Brian Brown" <Br********@discussions.microsoft.com> wrote in message
news:8B**********************************@microsof t.com...
Hi Julia,

I think that it entirely depends on what you are logging. If it is a
minimal amount of information that you are logging (e.g. Service x started,
Service x error..,etc) and the information fits one of the existing logs I believe that using an existing log would be fine. If you are logging an
extensive amount of information that would clutter the existing logs or
doesn't match the content I believe that it would be best to go with

your own
log. Just my opinion.

Hope this helps.
-------------------


Nov 16 '05 #5
Ollie,
Entries are also written to the 'Application' event log, unless you override
the ServiceBase.EventLog property & return a custom event log.

http://msdn.microsoft.com/library/de...ntlogtopic.asp

By overriding ServiceBase.EventLog & returning a NEW event log object you
can change where the AutoLog entries are written. The above page suggests
you cannot, however I believe the above page is referring to the fact you
cannot (should not) change the EventLog returned from the
ServiceBase.EventLog property, you need to return a new one!

NOTE: The entries written to the 'System' event log are still written
there...

Hope this helps
Jay

"Ollie Riches" <ol**********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
when a windows service starts or stops it is automatically logged to the
'System' event log.

HTH

Ollie Riches

"Julia" <co********@012.net.il> wrote in message
news:uS**************@TK2MSFTNGP11.phx.gbl...
Yes, i am thinking to log to the event log only "Service X
started\stopped.",
error and exceptions
and other stuff will goes to a log file

Thanks.

"Brian Brown" <Br********@discussions.microsoft.com> wrote in message
news:8B**********************************@microsof t.com...
> Hi Julia,
>
> I think that it entirely depends on what you are logging. If it is a
> minimal amount of information that you are logging (e.g. Service x

started,
> Service x error..,etc) and the information fits one of the existing
> logs I > believe that using an existing log would be fine. If you are logging
> an
> extensive amount of information that would clutter the existing logs or
> doesn't match the content I believe that it would be best to go with

your
own
> log. Just my opinion.
>
> Hope this helps.
> -------------------



Nov 16 '05 #6

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

Similar topics

6
by: Usman | last post by:
Hi I have a window service written in C#. I have another application that requires a lengthy process to be performed like taking backup. How can I make this lengthy process be performed by...
1
by: Sam | last post by:
Hi All I'm assigned a task to create some kind of services to monitor new sales in database and send out emails and I'm thinking to use window service to do that. Does anyone know where I can...
4
by: ianyian | last post by:
hi experts, im doing some staff bween th the aspx + MS Word.chellcheck, and and which running on my ypc is no problem ( windows xp , activation by ASPNET ), buts someshow when i try to deploy to...
1
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I have created a very simple window service. This window service in turn is calling a function that exist in a windows form. When I am trying to run this windows service. window...
7
by: =?Utf-8?B?Vmlua2k=?= | last post by:
public void sendKeysTest() { Process myProcess = Process.Start(@"C:\winnt\system32\cmd.exe"); SetForegroundWindow(myProcess.Handle); if (myProcess.Responding) SendKeys.SendWait("{ENTER}");...
2
by: =?Utf-8?B?YW5hbmQga3VtYXI=?= | last post by:
Hi, We have a requirement where windows service application XX will be deployed on two servers that is load balanced. The windows service polls the file directory and performs some logic when the...
0
by: henkya | last post by:
Language Used: C# Project Typed: Setup Project (for .NET Window Service) Hi Bump into this issue and seriously have a hunch that this is a bug in the .NET setup project. These are the scenario:...
0
by: olanger | last post by:
Let me explain the scenerio, I have a window service that has timer and OnElapsed timer event I'm calling a method. This method process business logic and It's multi threaded. The problem...when the...
2
by: gray d newbie | last post by:
Greetings All, This is my first time creating a Window Service and I am having this error message when I try to start my window service (currently known as Service1). Below is my code for Window...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.