HighTechTalks DotNet Forums  

Need to change defaults for CreateEventSource()

Dotnet Framework (CLR) microsoft.public.dotnet.framework.clr


Discuss Need to change defaults for CreateEventSource() in the Dotnet Framework (CLR) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Ken Varn
 
Posts: n/a

Default Need to change defaults for CreateEventSource() - 03-12-2007 , 12:03 PM






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
-----------------------------------



Reply With Quote
  #2  
Old   
Michael Nemtsev
 
Posts: n/a

Default Re: Need to change defaults for CreateEventSource() - 03-12-2007 , 03:05 PM






Hello Ken,

U can use Event Log Management Script tool for this
http://support.microsoft.com/default...b;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> -----------------------------------



Reply With Quote
  #3  
Old   
Nate Bolam
 
Posts: n/a

Default Re:Need to change defaults for CreateEventSource() - 10-10-2007 , 05:01 PM



Look at the EventLog.ModifyOverflowPolicy method. Set it to OverflowAction.
OverwriteAsNeeded for your custom log.

http://msdn2.microsoft.com/en-us/lib...stics.eventlog.
modifyoverflowpolicy.aspx

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.