I have a com interop dll working against a .NET SDK 22.214.171.124
I have the following code in my dll:
Common.Logging.LogManager.Adapter = new Common.Logging.NLog.NLogLoggerFactoryAdapter((Common.Logging.Configuration.NameValueCollection)null);
LoggingConfiguration config = new LoggingConfiguration();
var rule = new LoggingRule("*", m_minLogLevel, m_fileLog);
LogManager.Configuration = config;
I’ve made sure that the filename and logLevel params are getting through from the asp.
Also when I try to use Log.Trace(“hello”) in my interop .net code It’s working fine.
But no couchbase data is written to the logs.
(the reason I need the logs is to try to debug ‘NodeUnavailableException’ exceptions i’m getting sometimes when trying to get a key when I have about 20-50 concurrent connections from the same machine.
Does anyone have any idea why I’m having issue with logging or with the exception? (I’m on .net 4.5)
I’m not certain, but I think the issue is that you’re configuring NLog programatically. I think you need to configure it using XML and reference that in the adapter, using either INLINE or FILE. Alternatively, you can also put the adapter configuration in XML as well, and remove all programatic configuration.
Nlog is working when I configure it progamatically. just not in couchbase sdk.
Besides, I can’t configure it in web.config because i’m using asp and not asp.net. The configurations won’t be loaded this way.
I realize that it’s working elsewhere, but looking at the NLogLoggerFactoryAdapter it appears to me that it uses it’s own alternative configuration, not what you’ve loaded into the NLog LogManager.Configuration.
If you’re using ASP, you should be able to use the configType “FILE” option to load a separate nlog.config file (path in the “configFile” option). Something like this:
There’s also an issue with the version of Common.Logging.
SDK 126.96.36.199 is using Common.Logging 3.3.1
Even if i wanted to use the most recent version that Common.Logging.Nlog library supports, which is 4.4.1 I need to update it to Common.Logging 3.4.1. But your SDK doesn’t support that version. It throws an exception.
So right now the only thing possible is to use Common.Logging 3.3.1 + Common.Logging.Nlog41 v3.3.1 against Nlog 4.1.2