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.
| 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. |
|
|
|
ActiveForums 3.7
|