I have WCF project with other class libraries in a solution. I added Common.Logging using nuget package manager for projects which require logging.
I am getting this error :
Unable to create type 'Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net'
when I excute :
Common.Logging.ILog logger = Common.Logging.LogManager.GetLogger<Service1>();
logger.Error("Test");
My Web.Config is here
EDIT : Bin Folder have Common.Logging.Log4net1213.dll as well as log4net.dll
Check if your Common.Logging.Log4net.dll is copied to your output directory. In most cases the dll is missing because there is no direct reference in the project.
In your config you have:
<logging>
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net">
<arg key="configType" value="INLINE" />
</factoryAdapter>
</logging>
Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net -> references the Common.Logging.Log4Net.dll which is not in your directory. There is a Common.Logging.Log4Net1213.dll dll. So you can change the config to:
<logging>
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net1213">
<arg key="configType" value="INLINE" />
</factoryAdapter>
</logging>
Or rename the dll
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With