The first thing I would is to make sure log4net itself is working. Your config
file runs correctly when I add a ConsoleAppender:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
<layout type="log4net.Layout.SimpleLayout" />
</appender>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
<layout type="log4net.Layout.SimpleLayout" />
</appender>
<root>
<level value="ALL" />
<appender-ref ref="EventLogAppender" />
<appender-ref ref="ConsoleAppender" />
</root>
</log4net>
</configuration>
I can also see the entries in the Event Log. Internal debugging:
<appSettings>
<add key="log4net.Internal.Debug" value="true" />
</appSettings>
didn't show any problems. Do you get an exceptions when internal debugging is
turned on? From what I can tell it looks like there's something wrong with the
machine its running on.
----- Original Message ----
From: talktopete <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, November 11, 2008 4:34:20 PM
Subject: Trying to set up an EXTREMELY SIMPLE event log feature... and failing
terribly! Please help a newbie
Hi and thanks in advance for the help.
I'm tearing my hair out over here trying to get this to work: a siple logger
that writes to the application section of the event log.
This is using log4net 1.2.10.0
Here is the app config:
--------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="EventLogAppender"
type="log4net.Appender.EventLogAppender" >
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger
[%property{NDC}] - %message%newline" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="EventLogAppender" />
</root>
</log4net>
</configuration>
--------------------------------------------------------------------
here is my code:
log4net.Config.XmlConfigurator.Configure();
logger = LogManager.GetLogger("EventLogAppender");
logger.Error("test");
-------------------------------------------------------------------
No errors, nothing happens! I notice that there are no appenders.
nothing is written to the event log.
I am tearing my hair out trying to figure out what is going on, can somebody
help?
--
View this message in context:
http://www.nabble.com/Trying-to-set-up-an--EXTREMELY-SIMPLE-event-log-feature...-and-failing-terribly%21-Please-help-a-newbie-tp20448428p20448428.html
Sent from the Log4net - Users mailing list archive at Nabble.com.