net-commons / common-logging

A portable logging abstraction for .NET
http://net-commons.github.io/common-logging
Apache License 2.0
649 stars 203 forks source link

Unable to resolve dependencies. 'Log4Net 2.0.8' is not compatible with 'Common.Logging.Log4Net1211 3.4.1 constraint: Log4Net (= 2.0.0)'. #168

Closed oliveiramarcio closed 1 year ago

oliveiramarcio commented 6 years ago

Hi!

I'm receivint this error when I try to update Common Logging to 3.4.1 on Nugget on my Visual Studio 2017:

I update Log4Net to 2.0.8 and now I can't update Common Loggin because version 3.4.1 only accepts Log4Net 2.0.0...

Would not be Log4Net (>= 2.0.0) instead of Log4Net (= 2.0.0)?

Please fix it!

jjanuszkiewicz commented 6 years ago

Looks like the same problem I reported a while ago: https://github.com/net-commons/common-logging/issues/140. Unfortunately @sbohlen said it's a WONTFIX due to historical problems with non-semver changes in logger libraries :-(

@sbohlen is it an option for you to reconsider the versioning and dependency approach? I understand your arguments and don't want to fight them - they are all valid (although in the era of modern nuget and more widely adopted semver, I think protecting your users by force is less desired). But at the same time this makes the dependencies extremely strict and it's impossible to use common-logging in some scenarios (like in the company I work for). Would you consider it acceptable to release 2 versions of log4net adapter, one with safe, strict dependencies, and an alternative one with relaxed semver-based dependencies? Users of the latter one would be warned that the risk of breakage is on them. There are already unofficial nuget packages which do that (e.g. https://www.nuget.org/packages/Common.Logging.Log4Net.Universal), it's a shame I can't use the official one.

jjanuszkiewicz commented 6 years ago

Also, to give you more context on why it's problematic to use this package in my company: we have a rather large codebase (hundreds of projects and nuget packages) which various projects getting updated at a different pace, so we typically use slightly different versions of log4net across the codebase.

Now, if one project references others (directly or by nuget packages) which use different (but semver-compatible) versions of log4net, we just add a binding redirection to app.config of the consuming project and everything works. But if we want to use common.logging log4net adapter in that consuming project, we often have to uninstall the existing version of the adapter and install another one, which is unnecessary manual work.

Even worse, if I want to use the log4net adapts in one of my nuget packages (which happens to be widely used in other projects), I'm introducing a hard dependency on exact log4net version on my consumers. This is a major deal breaker for adopting the log4net adapter universally across our code.