Log4net compact framework 3.5 No app.config for adding file applications

I am developing log4net using CF 3.5 VS 2008 on Windows Mobile 6.

I used log4net before in my Windows xp applications, and always add the configuration to the app.config file.

However, this is my first experience using log4net with CF3.5. And I noticed that there is no app.config file, and when I try to add a new element, there is no template for it. Did I miss something?

If 3.5 does not have an app.config file. Where can I put my log4net configuration? I would like log4net using the appender file and save the log in the directory from which the application is running.

Thanks so much for any suggestions,

+3
source share
3 answers

, , , . , .

, XmlConfiguratorAttribute. . . , log4net "log4net.config", bin assemblyInfo.cs:

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

Ruben, , XmlConfiguratorAttribute log4net .

Instead, you can use the XmlConfigurator.Configure("filename.config")replacement filename.configfor the path to the log4net configuration file.

I put this in the main class of a Windows application program in my mobile application.

Embrace:)

+2
source

Source: https://habr.com/ru/post/1710050/


All Articles