Do you call ActivateOptions() when Threshold property is changed?
Radovan

-----Původní zpráva-----
Od: James Green [mailto:james.gr...@occam-dm.com] 
Odesláno: 19. června 2009 12:00
Komu: Log4NET User
Předmět: RE: Event Log Weirdness.

I should also point out that I know the Threshold is Off ...

I have explicit methods that switch this on in order to prevent the event log 
from being swamped with log entries as the processes we run here could produce 
millions of logs a day ...

Our default log destination is a SQL Database ...

James. 

-----Original Message-----
From: James Green
Sent: 19 June 2009 10:51
To: Log4NET User
Subject: Event Log Weirdness.

Hi All,
 
I'm just looking into an odd issue.  I have an EventLogAppender being 
configured in C#.  If I set this up to append to the "Application" log all is 
fine.
 
However, when I ask it to create a custom event log called LogTest its not 
working as expected.
 
Now the obvious thing is that the process doesn't have permissions ...
it does.  It created the new LogTest event log without problems but never 
writes to it ...
 
>From reading the log4net docs it would seem that if I can create the log 
>(which I can) it stands to reason that it should also be able to write to it.
 
This isn't an ASPNET process either, its a desktop windows application ... the 
C# that configures the LogAppender is:
 
public static void ConfigureEventLogAppender(string appName, string
logName)
{
    PatternLayout layout = GetDefaultLayout();
    _eventLogAppender = new EventLogAppender();
    _eventLogAppender.ApplicationName = appName;
    _eventLogAppender.Layout = layout;
    _eventLogAppender.LogName = logName;
    _eventLogAppender.Threshold = Level.Off;
    _eventLogAppender.ActivateOptions();
    BasicConfigurator.Configure(_eventLogAppender);
}

I can only assume that I'm missing something in this setup process but I can't 
see anything in the Xml versions of configuration that suggest what to do ...

Cheers,

James Green
Technical Lead - Core Systems
Occam DM Ltd
Tel: +44(0)1761234716


scanned by MessageLabs [www.messagelabs.com]

scanned by MessageLabs [www.messagelabs.com]


Reply via email to