NOTE: This method is now obsolete.
Use XmlConfigurator.Configure instead of DOMConfigurator.Configure
Configures log4net using the specified configuration file.
DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator.
The configuration file must be valid XML. It must contain at least one element called log4net
that holds the log4net configuration data.
The log4net configuration file can possible be specified in the application's configuration file (either MyAppName.exe.config
for a normal application on Web.config
for an ASP.NET application).
[C#]
using log4net.Config;
using System.IO;
using System.Configuration;
...
DOMConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"]));
In the .config
file, the path to the log4net can be specified like this :
[XML]
<configuration>
<appSettings>
<add key="log4net-config-file" value="log.config" />
</appSettings>
</configuration>
DOMConfigurator Class | log4net.Config Namespace | DOMConfigurator.Configure Overload List