You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Ron Grabowski (JIRA)" <ji...@apache.org> on 2008/01/11 01:48:34 UTC

[jira] Commented: (LOG4NET-133) Unable to use default config loading

    [ https://issues.apache.org/jira/browse/LOG4NET-133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557860#action_12557860 ] 

Ron Grabowski commented on LOG4NET-133:
---------------------------------------

Having a Log4NetConfigSectionHandler in your app.config shouldn't automatically configure log4net. There may be times when you want to keep that information in the config file but you don't want to use log4net.

I'm not sure I'm following what you're describing. According to this documentation:

 http://logging.apache.org/log4net/release/sdk/log4net.Config.XmlConfiguratorAttribute.html
 "
 If neither of the ConfigFile or ConfigFileExtension properties are set the configuration is loaded from the application's .config file.
 "

Is your underlying issue that you have a test case that calls code in another assembly and in that other assembly log4net is configured via XmlConfiguratorAttribute but the repository isn't getting configure?

> Unable to use default config loading
> ------------------------------------
>
>                 Key: LOG4NET-133
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-133
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.10
>            Reporter: Manuel Riezebosch
>
> Default config loading from app.config with the Log4NetConfigSectionHandler is not possible, because XmlConfiguratior.Configure(ILoggerRepository repository), where the ConfigurationManager is used, never gets called. 
> The DefaultRepositorySelector.ConfigureRepository only loads config when the (Xml)ConfiguratorAttribute is found in the loaded assembly and calls Configure(assembly, repository) on this attribute. When using the XmlConfiguratorAttribute, the XmlConfigurator.Configure(targetRepository, configFile) gets called, which doesn't use the ConfigurationManager but an XmlDocument instead.
> The most annoying thing is that you are required now to use the XmlConfiguratorAttribute on assembly level, because otherwise the configuration is ignored. See DefaultRepositorySelector line 657 for more details. This is a problem when using calling functions in external assemblies, for instance with unit testing, because the logging from the tested object is ignored because the configuration fails to load.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.