If you want to use the log4net.Config.DOMConfigurator.Configure() method to configure log4net then you must specify the log4net section handler to be "log4net.Config.Log4NetConfigurationSectionHandler,log4net" rather than the System.Configuration.IgnoreSectionHandler.
Cheers, Nicko > -----Original Message----- > From: Pawan Singh [mailto:[EMAIL PROTECTED] > Sent: 25 August 2004 21:34 > To: Log4NET User > Subject: RE: App.config file is causing errors in 1.2.8 > > It is simple VB.NET Windows Forms program. Here is the code: > > -Pawan > > Public Class Form1 > Inherits System.Windows.Forms.Form > > #Region " Windows Form Designer generated code " > #End Region > > Private Shared log As log4net.ILog = > log4net.LogManager.GetLogger("AnyName") > > Private Shared I As Integer = 1 > Private Shared FirstTime As Boolean = True > > Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles btnOK.Click > > If FirstTime Then > FirstTime = False > log4net.Config.DOMConfigurator.Configure() > End If > > ' log an event each time we click on the log button > > If log.IsDebugEnabled Then > log.Debug("My debug message" & I) > I += 1 > End If > > > End Sub > > > End Class > > -----Original Message----- > From: Nicko Cadell [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 25, 2004 1:22 PM > To: Log4NET User > Subject: RE: App.config file is causing errors in 1.2.8 > > It looks like it is failing before it finds the configuration xml. > > How are you telling log4net where the configuration is? > What type of programme are you writing? (console app/windows > app/asp.net) > > Can you include the whole of the log4net debug output (i.e. all the > log4net:* stuff). > > Thanks, > Nicko > > > -----Original Message----- > > From: Pawan Singh [mailto:[EMAIL PROTECTED] > > Sent: 25 August 2004 21:14 > > To: Log4NET User > > Subject: RE: App.config file is causing errors in 1.2.8 > > > > Even if the config file is empty, I get the same error. Is this a > > problem in Beta 8? > > > > Thanks > > Pawan > > > > <?xml version="1.0" encoding="utf-8" ?> <configuration> > > > > <configSections> > > <section name="log4net" > > type="System.Configuration.IgnoreSectionHandler" /> > > </configSections> > > > > <appSettings> > > <!-- To enable internal log4net logging specify > the following > > appSettings key --> > > <add key="log4net.Internal.Debug" value="true"/> > > </appSettings> > > > > <!-- This section contains the log4net configuration settings > > --> > > <log4net> > > </log4net> > > </configuration> > > > > > > -----Original Message----- > > From: Pawan Singh [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, August 25, 2004 11:45 AM > > To: [email protected] > > Subject: App.config file is causing errors in 1.2.8 > > > > Hi, > > > > I am using the log4net 1.2 beta 8 for .Net 1.1. The example config > > file in the distribution for vb.net does not work - so I > took elements > > from the Java version. Now all the configuration stuff is read, but > > DOMConfigurator prints an error. > > log4net:ERROR DOMConfigurator: ConfigureFromXML called with null > > 'element' parameter log4net:ERROR DOMConfigurator: > > ConfigureFromXML called with null 'element' parameter > > > > Here is my simple app.config file: > > > > <?xml version="1.0" encoding="utf-8" ?> <configuration> > > > > <configSections> > > <section name="log4net" > > type="System.Configuration.IgnoreSectionHandler" /> > > </configSections> > > > > <appSettings> > > <!-- To enable internal log4net logging specify > the following > > appSettings key --> > > <add key="log4net.Internal.Debug" value="true"/> > > </appSettings> > > > > <!-- This section contains the log4net configuration settings > > --> > > <log4net> > > > > <appender name="ConsoleAppender" > > type="log4net.Appender.ConsoleAppender"> > > <layout type="log4net.Layout.PatternLayout"> > > <param name="ConversionPattern" > > value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" /> > > </layout> > > </appender> > > > > <!-- Setup the root category, add the appenders > and set the default > > level --> > > <root> > > <level value="ALL" /> > > <appender-ref ref="ConsoleAppender" /> > > <!-- <appender-ref ref="A" /> --> > > </root> > > > > <!-- Specify the level for some specific categories --> > > <logger name="WindowsApplication1.Form1"> > > <!-- <appender-ref ref="B" /> --> > > <level value="ALL" /> > > <appender-ref ref="ConsoleAppender" /> > > </logger> > > > > > > </log4net> > > </configuration> > > > > > > > > > > > > > > >
