Nicko,
It wasn't an issue with the version of log4net I was using. The main problem
was in the configuration file. I had the <appsettings> section before the
<log4net> settings. This seemed odd to me, since in a typical XML document,
the order that the tags appear in doesn't matter. (I tested this to be
certain. When I change the order back again, it doesn't work.) I also
changed a section from this:
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
to this:
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net-net-1.1" />
</configSections>
It's now working, and I'm quite pleased with it. I've been very busy making
namespace level loggers for my project, and they are all performing nicely.
Just thought you'd be interested in hearing the details of the resolution.
Sheila
-----Original Message-----
From: Nicko Cadell [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 20, 2005 9:16 AM
To: Log4NET User
Subject: RE: Has Anyone Seen THIS Error Before?
Sheila,
Which version of log4net are your using?
If your not using 1.2 beta 8 I would recommend you try with that
version.
Cheers,
Nicko
> -----Original Message-----
> From: Sheila Martin [mailto:[EMAIL PROTECTED]
> Sent: 20 January 2005 03:01
> To: [email protected]
> Subject: Has Anyone Seen THIS Error Before?
>
> Hi!
>
>
>
> I'm brand new to using log4net, and am getting the following
> error when I try to run my test project:
>
>
>
> log4net:ERROR DOMConfigurator: ConfigureFromXML called with
> null 'element' parameter
>
>
>
> Needless to say, I am finding this quite frustrating, as I
> don't know enough about log4net to really be able to debug properly.
>
>
>
> The test project contains the following files:
>
>
>
> using log4net;
>
> using log4net.Config;
>
>
>
> public class LogTest2
>
> {
>
> private static readonly ILog logger =
> LogManager.GetLogger(typeof(LogTest2));
>
>
>
> static LogTest2()
>
> {
>
> DOMConfigurator.Configure();
>
> }
>
>
>
> static void Main(string[] args)
>
> {
>
> logger.Debug("Here is a debug log.");
>
> logger.Info("... and an Info log.");
>
> logger.Warn("... and a warning.");
>
> logger.Error("... and an error.");
>
> logger.Fatal("... and a fatal error.");
>
>
>
> }
>
> }
>
>
>
> <?xml version="1.0" encoding="utf-8" ?>
>
> <configuration>
>
> <configSections>
>
> <section name="log4net"
> type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
>
> </configSections>
>
> <log4net>
>
> <appender name="LogFileAppender"
> type="log4net.Appender.FileAppender">
>
> <param name="File" value="LogTest2.txt" />
>
> <param name="AppendToFile" value="true" />
>
> <layout type="log4net.Layout.PatternLayout">
>
> <param name="Header" value="[Header]\r\n" />
>
> <param name="Footer" value="[Footer]\r\n" />
>
> <param name="ConversionPattern"
> value="%d [%t] %-5p %c - %m%n" />
>
> </layout>
>
> </appender>
>
>
>
> <appender name="ConsoleAppender"
> type="log4net.Appender.ConsoleAppender" >
>
> <layout type="log4net.Layout.PatternLayout">
>
> <param name="Header" value="[Header]\r\n" />
>
> <param name="Footer" value="[Footer]\r\n" />
>
> <param name="ConversionPattern"
> value="%d [%t] %-5p %c - %m%n" />
>
> </layout>
>
> </appender>
>
>
>
> <root>
>
> <level value="INFO" />
>
> <appender-ref ref="LogFileAppender" />
>
> <appender-ref ref="ConsoleAppender" />
>
> </root>
>
> </log4net>
>
> </configuration>
>
>
>
> The configuration file 'lives' in the main project directory.
>
>
>
> I was really hoping that this would work, especially since I
> downloaded it from a tutorial site. I made no changes to the
> code - just created a new project and added the files.
>
>
>
> Any help (or links to tutorials) would be greatly appreciated.
>
>
>
> Thanks!!!
>
>
>
>