Writing to a custom event log

Hello

I've created a custom event log which I want my application to write events to. When I run my application it writes logs to the custom event log and also to the Application log. This is OK but all log entries in the Application log are also written to my custom event log. Is there a way to prevent other application to write to my custom event log?

I've created my custom event log like this

EventLog.CreateEventSource("MyCustomEvtSrc","MyCustomEvtLog");

I write logs like this

EventLog log =newEventLog("MyCustomEvtLog",".","MyCustomEvtSrc");

log.WriteEntry("Log message");

Thanks for your help,

/Ulf

[1215 byte] By [ulven] at [2007-12-24]
# 1

Do you have an EventLogTraceListener attached to your trace source (or the Debug or Trace classes) that is pointed to the Application log? If so then all traces would go to the Application log and your custom log as well. Look at the Source property along with the Log property of your event log object to be sure they are set correctly.

Michael Taylor - 9/28/06

TaylorMichaelL at 2007-10-8 > top of Msdn Tech,Visual C#,Visual C# General...
# 2

Hi Michael

Yes that solved my problem. I've been struggling with the logging application block in Enterprise Library and I thought I had deactivated the EventLogTraceListener. However I find it strange that log events from other applications were written to my custom log.

Thanks for your help

ulven at 2007-10-8 > top of Msdn Tech,Visual C#,Visual C# General...