Hi all:
I saw some classes with the following at head. What's its functionality?
[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension = "log4net", Watch = true)]
Thanks.
Hi all:
I saw some classes with the following at head. What's its functionality?
[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension = "log4net", Watch = true)]
Thanks.
It turns on processing of separate log4net configuration file with extension .log4net, enables watching file for changes (so if you decide, during program execution, that you want to change what should be logged where, etc, you can do it and log4net will pick up your changes immediately).
It depends on the contents of config file what will happen (if it will log anything or not).
But for logging to actually happen, classes must somehow use log4net class (well, they don't have to use it directly, anyway).
Take a look here for more info...
// Configure log4net using the .log4net file
[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension="log4net",
Watch=true)]
// This will cause log4net to look for a configuration file
// called TestApp.exe.log4net in the application base
// directory (i.e. the directory containing TestApp.exe)
// The config file will be watched for changes.
This attribute may only be used once per assembly.