Friday, May 18, 2012
 
The best way to analyze your logs! Minimize
 Log4Net Mail archive   

The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.

Subject: Log4Net failed in .net 3.5 Framework
Prev Next
You are not authorized to post a reply.

Author Messages
CheeHong

06/21/2008 11:49 AM  


Hello,

I had jus migrated my VS2003 project to VS2008 Evaluation version. I found
out that my log4net is giving me an error in which previously it didn't
complain.

Function I called is LogManager.GetLogger(name)

It gives me "TypeInitializationException was unhandled" error, with the
inner exception as "The type initializer for 'log4net.helpers.LogLog' threw
an exception". Go in further it mention about my app.config file is having
unrecognised element.

My app.config has the following structure:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <Hello>
       .....
       .....
    </Hello>
  </appSettings>
  </configuration>

It is complaining about <Hello> being the unrecognized element. But I am
able to use log4net in VS2003 without any errors. Could it be due to the
incompatibility of using log4net on VS2008 ?

Is there a log4net version for .net framework 3.5 ?

Can anyone help me on this, any suggestions are welcomed.

Thanks in advance.

Regards,
Chee Hong
--
View this message in context: http://www.nabble.com/Log4Net-failed-in-.net-3.5-Framework-tp18042667p18042667.html
Sent from the Log4net - Dev mailing list archive at Nabble.com.

Ron Grabowski

06/21/2008 10:42 PM  

If the exception message mentioned your app.config being malform perhaps you should use a well formed app.config. This is incorrect:

   <appSettings>
    <Hello>
       .....
       .....
    </Hello>
  </appSettings>

AppSettings can only contain <add /> nodes:

 <appSettings>
  <add key="log4net.Internal.Debug" value="true" />
 </appSettings>

Since new version of the Framework are backwards compatible with previous versions, the latest version of the log4net is compatible with version 3.5 of the Framework.

CheeHong

06/22/2008 6:41 AM  


Hello,

Thanks for your prompt reply. Appreaciated.

I know there are certain restrictions on App.config for adding custom
section handlers. But I didn't quite understand why such errors were not
reported when I was using VS 2003 ( with log4net ) ?

It would be quite troublesome for me to re-structure my App.config file as I
built my project flow according to format as follows:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <Hello>
       .....
       .....
    </Hello>
    < Hello2>
    </Hello2>
  </appSettings>
  </configuration>

Is anyone facing this issue as well ? How come I was able to run smoothly
without any errors in VS2003 but not with VS2008 ?

Chee Hong

Ron Grabowski

06/22/2008 2:58 PM  

Can you post the entire stack trace of the exception? Is the Framework raising the exception or is log4net? If the Framework is raising the exception then its not a log4net issue.

Your App.Config is wrong. You need to fix that. Perhaps you're just seeing these errors now because newer versions of the Framework have improved error checking.

The version of Visual Studio you're using doesn't really matter here. This is a .NET Framework issue.

You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > Log4Net failed in .net 3.5 Framework



ActiveForums 3.7

 

 

 

 

 

 

 

 

Log4Net Dashboard

Log analysis and monitoring made easy!

Log4Net Dashboard is a log viewer that can read log statements from a variety of logging output targets.

You can download a free developer version.

  

Check it out!

On the demonstration site you can try it  with live data.demo.l4ndash.com - Try Log4Net Dashboard with live data

The mail archive is a copy of all the mail sent to the mail address: log4net-user@logging.apache.org, organized as a forum.

If you would like to participate in the mail list, send a mail to log4net-user-subscribe@logging.apache.org.

More information about the mailing list is available on: http://logging.apache.org/log4net/support.html

 

A complete topic list is available and can be viewed here (warning, it takes some time to load)

 

Copyright 2005-2008 by FaktNet AS Terms Of Use Privacy Statement