Solved

Writing Windows Service1 Event Log?

Posted on 2006-06-30
1
369 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
ID: 17022696
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

789 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