Couchbase Logging issue


#1

I have got a strange issues with Couchbase once i update it to the latest version (through NuGet).

My MVC web app uses log4net loading it from unity container.

Suddenly Couchbase Cluster constuctor started to throw an exception saying:

Method not found: ‘Common.Logging.ILog Common.Logging.LogManager.GetCurrentClassLogger()’.

Stack trace:

at Couchbase.Cluster…cctor()

Any idea? How could i solve this problem?


#2

Ok, i suspect to find an answer.
I have downloaded a source codes for Couchbase Net Client and see here is used DEPRECATED lib - Common.Logging.Log4Net.

As there is no way to install it from NuGet its missing in the project… Could be it trying log4net classes in this case…

Couchbase team, any ideas? I spent whole day tryin to launch my project after update and still facing problems.

Addition:
I was able to make my project alive doing following things:

  1. Attach DEPRECATED Common.Logging.Log4Net lib from open source of .NET Client lib of Couchbase.
  2. Roll back versions of log4net to 1.2.10 (from 1.2.13) and Common.Logging to 2.0.0 (from 3.0.0)

This is completely nonsense! I had to remove or downgrade some libs that require latest versions of log4net, for instance Log4NetunityExtension that requires 1.2.13.

Again, a question to Client for .NET developers… Is there any way to have updated client lib that uses latest libs from NuGet?


#3

Hi @arkadyb -

The Couchbase project (which produces the Couchbase.NetClient.dll) only has a dependency on Common.Logging; it’s up to the user of the assembly to provide a dependency on the logging library that they wish to use (of course it must be a Common.Logging compatible library like Common.Logging.Log4Net).

However, the Couchbase.Tests project does use the Common.Logging.Log4Net version that is deprecated (the maintainers of the library deprecated it sometime in November or December of last year). It still works, it’s just deprecated. There is a jira ticket to update the SDK for the 2.0.2 release: https://issues.couchbase.com/browse/NCBC-749

Until the SDK upgrades to a more recent version, any code that uses it will have to use a compatible version of it’s dependencies as well.

-Jeff


#4

Hello Jeff,

Thanks for your answer!

After looking for a proper solution i found a version of Log4Ned adapter for Common.Logging for latest version of log4net - Common.Logging.Log4Net1213. But now it does not work with couchbase client as Couchbase client uses version of Common.Logging 2.0, when Log4Net1213 requires 3.0.

So far it seems ill have to update version in Couchbase Client source codes manually and keep it going out of NuGet… This is pity.


#5

Hi Jeff,

I am seeing the same exception when attempting to use the latest version of Common.Logging (3.0).
Everything works as expected with the version shipped with the 2.0.1 .Net client (which is 2.0).

A quick glance suggests the issue could be that the method in question ‘Common.Logging.LogManager.GetCurrentClassLogger()’ has been deprecated but I have yet to look further into this.

Using the method causes the following warning: warning CS0618: ‘Common.Logging.LogManager.GetCurrentClassLogger()’ is obsolete: ‘Null-Reference Exception when dealing with Dynamic Types, Prefer instead one of the LogManager.GetLogger(…) variants.’

Is there any plans to move to the latest version of Common.Logging, or at least to stop using this method?

-Nick


#6

@nick_adcock -

That will be resolved in 2.0.2; https://issues.couchbase.com/browse/NCBC-788. It’s in code review ATM, waiting to be merged into master.

Thanks!

-Jeff