You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by suedeuno <su...@yahoo.com> on 2008/12/03 19:42:06 UTC

error XmlConfigurator: Failed to parse config file.

I'm getting this error when running a unit test. It does complete the logging
in spite of this error. I need to resolve this so that the automated build
process does not fail. Any ideas?:

log4net : error XmlConfigurator: Failed to parse config file. Is the
<configSections> specified as: <section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler,log4net,
Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821" />


app.config:
    <configSections>
        <section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
    </configSections>

In code:
            log4net.Config.XmlConfigurator.Configure();
            log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            log.Error("message);
-- 
View this message in context: http://www.nabble.com/error-XmlConfigurator%3A-Failed-to-parse-config-file.-tp20819038p20819038.html
Sent from the Log4net - Users mailing list archive at Nabble.com.


Re: error XmlConfigurator: Failed to parse config file.

Posted by suedeuno <su...@yahoo.com>.
It seems that using the XmlConfigurator attribute in assemblyinfo works with
default .config files but the fluent XmlConfigurator does not. Consequently,
using the fluent configuration with non-default config files works as long
as I have the path correct. Seems strange to me. 

One question, does XmlConfigurator have to be called in every project that
will use logging? I created a wrapper aroung log4net and would like to just
call XmlConfigurator within the wrapper class only but that doesn't seem to
work for me. It won't log unless I have XmlConfigurator called in every
project using log4net. Any help would be appreciated. Seems configuring
log4net is not as easy as the few tutorials online seem to claim. 



Freddy Gómez wrote:
> 
> If you add to the config file the section:
>  <appSettings>    <add key="log4net.Internal.Quiet" value="false" />
>   </appSettings>
> 
> you will get in the output window of Visual Studio debug information from
> log4net.
> 

-- 
View this message in context: http://www.nabble.com/error-XmlConfigurator%3A-Failed-to-parse-config-file.-tp20819038p20824938.html
Sent from the Log4net - Users mailing list archive at Nabble.com.


Re: error XmlConfigurator: Failed to parse config file.

Posted by Freddy Gómez <gc...@gmail.com>.
If you add to the config file the section:
 <appSettings>    <add key="log4net.Internal.Quiet" value="false" />
  </appSettings>

you will get in the output window of Visual Studio debug information from
log4net.

On Wed, Dec 3, 2008 at 2:12 PM, suedeuno <su...@yahoo.com> wrote:

>
> I'm getting this error when running a unit test. It does complete the
> logging
> in spite of this error. I need to resolve this so that the automated build
> process does not fail. Any ideas?:
>
> log4net : error XmlConfigurator: Failed to parse config file. Is the
> <configSections> specified as: <section name="log4net"
> type="log4net.Config.Log4NetConfigurationSectionHandler,log4net,
> Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821" />
>
>
> app.config:
>    <configSections>
>        <section name="log4net"
> type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
>    </configSections>
>
> In code:
>            log4net.Config.XmlConfigurator.Configure();
>            log =
>
> LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
>            log.Error("message);
> --
> View this message in context:
> http://www.nabble.com/error-XmlConfigurator%3A-Failed-to-parse-config-file.-tp20819038p20819038.html
> Sent from the Log4net - Users mailing list archive at Nabble.com.
>
>