System Event Log Properties (Overwrite)

Topics: Logging Application Block
Jun 12, 2009 at 8:30 PM
Edited Jun 16, 2009 at 7:03 PM

In order to adjust the properties for a system event log, after the Logging Application Block creates it, I could run code like this:

if (EventLog.Exists(ServicePluginInstaller.LogName)){
  EventLog logSink = new EventLog(ServicePluginInstaller.LogName);
  logSink.MaximumKilobytes = 16384;
OverflowAction.OverwriteAsNeeded, 7);

But shouldn't the Logging block have a configuration item that handles this for me?  I'm using EntLib 4.1.

Jun 15, 2009 at 8:39 AM

I can't answer design questions but the reason may be probably due to permission issues.  As you would've noticed, the LAB's FormattedEventLog TraceListener doesn't include any configuration which would alter the eventlog source settings.  The source you specified should even be existing prior to logging to it.


Sarah Urmeneta
Global Technology & Solutions
Avande, Inc.

Jun 16, 2009 at 7:07 PM

Ok, instead I'll just use the code I exampled above.

Incidentally, I see that the FormattedEventLog TraceListener does not include properties for adjusting the "eventlog source settings," but I'm not talking about the "eventlog source."  Instead, I'm talking about the eventlog sink, that is, the log itself.  But of course that doesn't change the answer to this question...