Adrian,
ConfigureAndWatch does not throw an exception if there is an error
in the config file, as this could have unforeseen effects on the
application using it. Currently there is no simple way to determine
whether log4net configuration has succeeded, but there is a bug raised
(http://issues.apache.org/jira/browse/LOG4NET-2) regarding this.
Niall Daley
On Wed, 16 Mar 2005, Adrian Walls wrote:
> Hi,
>
> I am using the log4net 1.2 framework in my application. I am using the
> DOMConfigurator.ConfigureAndWatch(FileInfo) to read and monitor an
> external configuration file. See code below which I us to start my logger.
>
> Private Sub startLogger()
> Dim sr
> Try
> 'Start Application Logger
> DOMConfigurator.ConfigureAndWatch(log4netConfig)
> Catch e As Exception
> sr = New StreamWriter("C:\Log4NetErrorStartLogger.log")
> sr.WriteLine("Exception: " + e.Message())
> sr.Close()
> End Try
>
> However if there is an issue with the config file (if for example I
> remove a brace from one of the XML tags to throw an parsing exception)
> then log4net will simply not log anything. But it does not throw an
> exception to indicate that there is something wrong, should it not
> catch exceptions thrown by the DOMConfigurator and write it to the
> stream writer log file as configured as above.
>
> Or is there some issue with my code above. Any help which can shed some
> light on this issue will be greatly appriciated.
>
> Regards,
> Adrian
>
>
>
--
Niall Daley
Log4net Dev