Solved

Writing Windows Service1 Event Log?

Posted on 2006-06-30
1
358 Views
Last Modified: 2009-07-29
I've reviewed and coded many attempts of Event Log writing for a service with no success.

Here's my latest code that doesn't compile error, but doesn't write the the Windows XP "Application" log eiter.

 EventLog eventLog = new EventLog();
            eventLog.Log = "Application";
            eventLog.WriteEntry("Event Log Writing Test!", EventLogEntryType.Error);
0
Comment
Question by:kvnsdr
1 Comment
 
LVL 22

Accepted Solution

by:
cookre earned 250 total points
Comment Utility
You left out event source info.  This works just fine:

string EvtSrc="BoxMonSvc";
string EvtLog="System";
string EvtMsg="BoxMon is still alive";
if (!EventLog.SourceExists(EvtSrc)) EventLog.CreateEventSource(EvtSrc,EvtLog);
EventLog.WriteEntry(EvtSrc,EvtMsg,EventLogEntryType.Information,42);
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now