DOMConfigurator Configure Method (ILoggerRepository, FileInfo) | Apache log4net™ SDK Documentation

Note: This API is now obsolete.

Configures the ILoggerRepository using the specified configuration file.

Namespace: log4net.Config
Assembly: log4net (in log4net.dll) Version: 2.0.8.0-.NET 4.0
Syntax

C#
VB
C++
F#
Copy

    [ObsoleteAttribute("Use XmlConfigurator.Configure instead of DOMConfigurator.Configure")]
    public static void Configure(
    	ILoggerRepository repository,
    	FileInfo configFile
    )

    <ObsoleteAttribute("Use XmlConfigurator.Configure instead of DOMConfigurator.Configure")>
    Public Shared Sub Configure (
    	repository As ILoggerRepository,
    	configFile As FileInfo
    )

    public:
    [ObsoleteAttribute(L"Use XmlConfigurator.Configure instead of DOMConfigurator.Configure")]
    static void Configure(
    	ILoggerRepository^ repository,
    	FileInfo^ configFile
    )

    [<ObsoleteAttribute("Use XmlConfigurator.Configure instead of DOMConfigurator.Configure")>]
    static member Configure :
            repository : ILoggerRepository *
            configFile : FileInfo -> unit

#### Parameters

repository
  Type: log4net.Repository
  ILoggerRepository
  The repository to configure.
configFile
  Type: System.IO
  FileInfo
  The XML file to load the configuration from.

Remarks

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 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).

Examples

The following example configures log4net using a configuration file, of which the location is stored in the application's configuration file :
C#
Copy

    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 :

Copy

    <configuration><appSettings><add key="log4net-config-file" value="log.config" /></appSettings></configuration>

See Also

#### Reference

DOMConfigurator Class
Configure Overload
log4net.Config Namespace