How to point Log4net to its configuration file? -



How to point Log4net to its configuration file? -

we moved our tests nunit mstest. using spring.net ioc container , log4net. log4net unable find log4net.xml despite having in test project. ideas be?

here error receiving:

unable create instance of class ourcompany.dataaccess.documentmanagement.tests.emailverificationtokensadaptertests.deletetests. error: common.logging.configurationexception: unable create instance of type common.logging.log4net.log4netloggerfactoryadapter. possible explanation lack of 0 arg , single arg namevaluecollection constructors ---> system.reflection.targetinvocationexception: exception has been thrown target of invocation. ---> common.logging.configurationexception: log4net configuration file 'log4net.xml' not exists. @ common.logging.log4net.log4netloggerfactoryadapter..ctor(namevaluecollection properties) --- end of inner exception stack trace --- @ system.runtimemethodhandle._invokeconstructor(iruntimemethodinfo method, object[] args, ref signaturestruct signature, runtimetype declaringtype) @ system.runtimemethodhandle.invokeconstructor(iruntimemethodinfo method, object[] args, signaturestruct signature, runtimetype declaringtype) @ system.reflection.runtimeconstructorinfo.invoke(bindingflags invokeattr, binder binder, object[] parameters, cultureinfo culture) @ system.runtimetype.createinstanceimpl(bindingflags bindingattr, binder binder, object[] args, cultureinfo culture, object[] activationattributes) @ system.activator.createinstance(type type, bindingflags bindingattr, binder binder, object[] args, cultureinfo culture, object[] activationattributes) @ common.logging.logmanager.buildloggerfactoryadapter() --- end of inner exception stack trace --- @ common.logging.logmanager.buildloggerfactoryadapter() @ common.logging.logmanager.get_adapter() @ spring.testing.microsoft.abstractspringcontexttests..ctor() @ spring.testing.microsoft.abstracttransactionaldbproviderspringcontexttests..ctor() @ ourcompany.tests.common.domain.satransactionalintegrationtestsbase..ctor() in satransactionalintegrationtestsbase.cs: line 19 @ ourcompany.dataaccess.documentmanagement.tests.emailverificationtokensadaptertests.deletetests..ctor() in deletetests.cs: line 20

here have in config file:

class="lang-xml prettyprint-override"><?xml version="1.0" encoding="utf-8" ?> <configuration> <configsections> <sectiongroup name="common"> <section name="logging" type="common.logging.configurationsectionhandler, common.logging" /> </sectiongroup> </configsections> <common> <logging> <factoryadapter type="common.logging.simple.traceloggerfactoryadapter, common.logging"> <arg key="level" value="all" /> <arg key="showlogname" value="true" /> <arg key="showdatatime" value="true" /> <arg key="datetimeformat" value="yyyy/mm/dd hh:mm:ss:fff" /> </factoryadapter> </logging> </common> </configuration>

here's snippet of web.config file, here's steps: can add together key in appsettings points external config file containing log4net settings:

class="lang-xml prettyprint-override"> <appsettings> <add key="log4net.config" value="configs\develop.config" /> </appsettings>

here's external config file:

class="lang-xml prettyprint-override"><log4net> <root> <appender-ref ref="logfileappender" /> </root> ... </log4net>

while in code setup xmlconfigurator:

class="lang-cs prettyprint-override">config.xmlconfigurator.configure(new fileinfo(configurationmanager.appsettings("log4net.config")))

log4net log4net-configuration

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -