You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Sheila Martin <sm...@tds.net> on 2005/01/20 04:01:12 UTC

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!!!

 


RE: Has Anyone Seen THIS Error Before?

Posted by Sheila Martin <sm...@tds.net>.
Graham,

Just in case you're  curious.....

I resolved my log4net issue. For details, see my reply to Nicko.

Thanks again for your help!

Sheila

-----Original Message-----
From: Graham Innocent [mailto:gi@parthenoncomputing.com] 
Sent: Thursday, January 20, 2005 8:59 AM
To: Log4NET User
Subject: Re: Has Anyone Seen THIS Error Before?


> 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!!!

Hi Sheila,
   A couple of things to check first:-

1) Does the config file have the same name as the executable, but with 
.config appended to the end ? (e.g. sheilasapp.exe.config)

2) Is it being copied to the directory where you execute the code from ?

3) Once it's there, does your application have read permission ?

Hope this helps,
   Graham

Graham Innocent Parthenon Computing
+44-1865-811184 http://www.parthcomp.com




Re: Has Anyone Seen THIS Error Before?

Posted by Graham Innocent <gi...@parthenoncomputing.com>.
> 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!!!

Hi Sheila,
   A couple of things to check first:-

1) Does the config file have the same name as the executable, but with 
.config appended to the end ? (e.g. sheilasapp.exe.config)

2) Is it being copied to the directory where you execute the code from ?

3) Once it's there, does your application have read permission ?

Hope this helps,
   Graham

Graham Innocent Parthenon Computing
+44-1865-811184 http://www.parthcomp.com