tags:

views:

1790

answers:

3

Hello,

I am developing a log4net using CF 3.5 VS 2008 on windows mobile 6.

I have used log4net before in my windows xp applications, and I always put the configuration in the app.config file.

However, this is my first time using log4net with CF3.5. And I have noticed there is no app.config file, and when I try to add a new item there is no template for one. Am I missing something here?

If 3.5 doesn't have a app.config file. Where can I put my log4net configuration? I would like to log4net using the file appender and save the log in the directory where the application is executing from.

Many thanks for any suggestions,

+1  A: 

Compact framework does not support app.config files but you can emulate such behavior.

Create a xml with setting and then read content of that file.

I found this workaround that work for me:

http://www.eggheadcafe.com/articles/dotnetcompactframework_app_config.asp

RomanT
A: 

This reaction is a bit late, and probably you have solved it already. However there might be some other users that have the same problem.

You can also specify that you want to use a different config-file using the XmlConfiguratorAttribute. See here. For instance you could specify the log4net-configuration in 'log4net.config' which is in your bin-directory and add in the assemblyInfo.cs:

[assembly: log4net.Config.XmlConfigurator(ConfigFile="log4net.config",Watch=true)]
Ruben
A: 

Hi, Ruben. This won't work cause XmlConfiguratorAttribute is not available from log4net to compact framework.
Instead, you can use XmlConfigurator.Configure("filename.config") replacing "filename.config" by the path to your log4net configuration file.
I've put this on the main Program class of a Windows Application on my mobile application.

Hugs :)

Diogo Paschoal