all groups > dotnet clr > march 2007 >
You're in the

dotnet clr

group:

Need to change defaults for CreateEventSource()



Need to change defaults for CreateEventSource() Ken Varn
3/12/2007 12:03:53 PM
dotnet clr: The EventLog.CreateEventSource() call creates an event source in Event
Viewer if it does not exist. However, the defaults that it uses for the
Event Source settings are not desirable for my application. In particular,
I would like to have the "Overwrite Events as Needed" option set instead of
the "Overwrite Events older than 7 days" option set upon creation. Is there
a way to change this default setting programmatically in native .NET without
having to manually go into Event Viewer and change it?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------

Re: Need to change defaults for CreateEventSource() Michael Nemtsev
3/12/2007 7:05:44 PM
Hello Ken,

U can use Event Log Management Script tool for this
http://support.microsoft.com/default.aspx?scid=kb;en-us;318763

---
WBR, Michael Nemtsev [C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

Kn> The EventLog.CreateEventSource() call creates an event source in
Kn> Event Viewer if it does not exist. However, the defaults that it
Kn> uses for the Event Source settings are not desirable for my
Kn> application. In particular, I would like to have the "Overwrite
Kn> Events as Needed" option set instead of the "Overwrite Events older
Kn> than 7 days" option set upon creation. Is there a way to change
Kn> this default setting programmatically in native .NET without having
Kn> to manually go into Event Viewer and change it?
Kn>
Kn> EmailID = varnk
Kn> Domain = Diebold.com
Kn> ----------------------------------

Re:Need to change defaults for CreateEventSource() Nate Bolam
10/10/2007 4:01:43 PM
Look at the EventLog.ModifyOverflowPolicy method. Set it to OverflowAction.
OverwriteAsNeeded for your custom log.

http://msdn2.microsoft.com/en-us/library/system.diagnostics.eventlog.
AddThis Social Bookmark Button