New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PROPOSAL: Introduce .NET Standard support in Common.Logging 4.0 and sunset Common.Logging 3.x after 3.4 #148
Comments
That all sounds reasonable to me, but would it be feasible to multitarget both netstandard and .NET Framework for those poor souls still on a version lower than 4.5? Would it require any extra work? I don't have any personal stake in it, just wondering. |
I think I'd say that we can explore that and try to determine the LOE required to support that. If it can be achieved with a reasonable effort, I'd say we should try to accommodate as best we can. I think in general the objectives go like this:
If we can achieve the above with adding support for e.g., .NET 3.5 then I think we're interested in going there; and if not, then not :) |
Hi! Even though I am not using this lib atm, going in this direction definitely seems the way to go. I am for my self in the process of updating/restructuring some of my packages. And for the matter of the lost souls still sticking with eg. .net2.0: |
@earloc Thanks for the input (and the links). I'd not seen the second of those, but was aware of the process outlined there (agree w/ the author that its scattered all over the place and its helpful to have it all in one place). As mentioned, we're not surrendering on supporting older/legacy versions of .NET Framework where the effort is considered somewhat minimal. But we are shifting our approach with an eventual 4.0 release to place less of an emphasis on continuing to support older versions of the framework to ensure continued compatibility and more of an emphasis on simplifying the complexity that supporting so many parallel versions of the framework has created for this project. Your point that multi-targeting in VS 2017/net-standard is already much simplified from the PCL approach is well-taken, however. It may well be that after a grand refactoring of the solution to rely upon this new approach, we discover that its "just as easy" to continue to support older framework versions. That said, there are a number of pending ISSUES/suggestions for changes to Thanks again for your feedback/input; more perspectives are definitely better than fewer! |
Will the new .NET Standard version be compatible with previous versions? |
@sbohlen - does it means that Microsoft.Extensions.Logging in .net core will be eventually deprecated and replaced with new Common.Logging 4 from .net standard, or they are going to co-exists? I have some libraries working with Common.Logging and want to use them in .net core. Should I rewrite everything to match Microsoft.Extensions.Logging or wait for Common.Logging 4? Since we need one abstraction, now is unclear what is the roadmap for Microsoft.Extensions.Logging. |
I'm a bit in the same case than @jovanpop-msft But now what should we do in our AspNetCore applications ? Use Common.Logging or Microsoft.Extensions.Logging which is designed with DI in mind from the start ? We use NLog as the concrete implementation, and NLog team has provided an adapter to use it above Microsoft.Extensions.Logging. But Common.Logging team seems moving slower and is not yet ready. The solution I've start to develop is to create a Common.Logging.ILoggerFactoryAdapter that is based on Microsoft.Extensions.Logging, so I can inject NLog in Microsoft.Extensions.Logging with the package provided by the NLog team, and then inject Microsoft.Extensions.Logging in Common.Logging so our legacy code based on Common.Logging can continue to works. With that approach we probably won't need a new version of Common.Logging, and we will probably consider Common.Logging as a legacy framework, because if NLog team maintain themselves the adaptation to the Microsoft.Extensions.Logging abstraction I will be much confident than a maintenance done by a third party team like it was with Common.Logging due to the inherent delay between a new release of the product and the adapter when it's done by different teams. What the community though about that approach ? nb: I didn't find any adapter that already do that. But If it's successful we can open source it and release it |
Creating an adapter between Common.Logging and Microsoft.Extensions.Logging was not a so good idea. So we choose to roll-back from that idea and compile internally an nlog adapteur for common.logging in netstandard. Which means that we are still interested by a new version of common.logging fully compatible with NetStandard which will sometimes live side by side with Microsoft.Extensions.Logging.Abstraction |
@sbohlen Can we get an update on this? Is there any movement on v4.0 with .NET Standard and .NET Core support or has this project been abandoned? I don't see any significant progress over the past year. We are trying to determine if we should continue with Common.Logging for .NET Core projects and create our own adapters or migrate to Microsoft.Extensions.Logging since NLog and other logging frameworks provide their own adapters for that API. Thanks! |
@sbohlen Could I help somehow with the move to version 4? |
@tonycoelho, @mnivet, is it a good idea to help with the project? Might be do some fork and work on this support (at least for Common.Logging -> NLog)? I personally love common logging and it is really good working with slightly different approach than Microsoft Logging extensions. I personally will be able to look at the sources sometime next week. |
All pull requests are always welcome! For what its worth, current plans call for me to be able to return to focus more on this effort beginning at the start of November (after a number of current other distractions are resolved elsewhere in my life). My goal would be to have this (and other unaddressed issues) resolved by the end of calendar 2018 latest. That said, if anyone wants to fork the repo and submit a PR for any open work (port to .net standard, support for later nlog, etc.), all pull requests are always welcomed! |
@sbohlen I will look what I can do in terms of the porting to .net standard over this weekend. @tonycoelho, @mnivet do you also have some preferences in version terms in the terms of porting? |
I've just open to public the common.logging.nlognetstandard adapter that have been write internally in our company. You can found it here: @sbohlen how do you prefer to integrate that ?
|
As new style of csproj, can utilize different build frameworks and generate the output correctly. I can suggest the following refactoring:
It may simplify the things a little bit and easy out the support. |
Hi all. I've done something in my fork. @mnivet did your version include the integration with Microsoft.Logger as well? |
@Defee no, That idea was abandoned as Iv'e explain a bit earlier in this thread |
@mnivet I found something. Basically it is how NLog did their extension for the microsoft logging. I think for Common it should be the same way of doing it. It is not much work, but I need to find time to do that. Possibly early next month. |
@Defee interesting idea. I've trying to adapt microsoft logging to common logging with mixed results. My tries make me think that common logging and Microsoft logging are both interfaces that should be implemented (through adapters) by a final framework (like nlog), but that there is no real advantage to adapt one above the other, even if you reverse the order that I have tried. Then, each project should choose to use common logging or microsoft logging, and DI must bind the chosen implementation (nlog or any other logging framework) to the the interface(s) that are used in the dependencies of the final app. To achieve that properly we need to have more modern Common Logging packages that support NetStandard, and that are more DI oriented (with less static entry points and generic logger interface) so all types of projects can have a real choice between common logging and microsoft logging, because for instance netstandard project are limited to Microsoft logging, and net framework projects are limited to common logging, which is not a real choice |
Created PR #176 for resolving this for NLog. (Includes custom build of nuget-package as attachment) |
Hi all! @snakefoot, could we have might be a Skype call/or other call just to see our diffs for NLog implementation ( I think it shouldn't be much)? |
Sure will do over the week. P.S. Tested now it seems it builds as of now and tests pass. |
@snakefoot /// <summary>
/// Actually sends the message to the underlying log system.
/// </summary>
/// <param name="logLevel">the level of this log event.</param>
/// <param name="message">the message to log</param>
/// <param name="exception">the exception to log (may be null)</param>
protected override void WriteInternal(LogLevel logLevel, object message, Exception exception)
{
LogLevelNLog level = GetLevel(logLevel);
LogEventInfo logEvent =
LogEventInfo.Create(level, _logger.Name, exception, null,"{0}", new object[] {message});
_logger.Log(declaringType, logEvent);
}
private static LogLevelNLog GetLevel(LogLevel logLevel)
{
switch (logLevel)
{
case LogLevel.All:
return LogLevelNLog.Trace;
case LogLevel.Trace:
return LogLevelNLog.Trace;
case LogLevel.Debug:
return LogLevelNLog.Debug;
case LogLevel.Info:
return LogLevelNLog.Info;
case LogLevel.Warn:
return LogLevelNLog.Warn;
case LogLevel.Error:
return LogLevelNLog.Error;
case LogLevel.Fatal:
return LogLevelNLog.Fatal;
case LogLevel.Off:
return LogLevelNLog.Off;
default:
throw new ArgumentOutOfRangeException("logLevel", logLevel, "unknown log level");
}
} What side-effects can it bring? |
Thank you for reporting this. Guess that is the price of copy-paste-code. Guess it is time to divert from the Serilog-default-implementation.
Well I have now updated my PR #176 to include better handling of callsite. |
Thanks @snakefoot! Will merge it again. I will also give a heads-up after I finish out this. |
@sbohlen @snakefoot I uploaded some packages manually to nuget as pre-release with my prefix("defee.").:
I checked following things and what have I done back in November 2018:
I wanted to suggest the following approach for the 4.x.x versioning
Current Issues and breaking changes(as per my memory now):
Suggested approach for the versioning integrations and checking those separately.
The pros of the suggested approach are following:
Cons:
PS. |
I vote for original proposition: version 4.0 only for Dotnet Core. In my private clone of Common.Logging I've added support for old configurations. I've observed following: Next thing is that Common.Logging should provide implementation for Microsoft.Extensions.Logging abstraction. |
The project team would like to solicit comments/input from the community on the following proposal.
With all the churn in the .NET stack over the past few years, (e.g., PCLs, .NET Framework Profiles, WinRT, .NET Core, .NET Standard), its been challenging to keep projects like Common.Logging entirely aligned with what's needed for its adopters within all of the differing flavors of .NET.
Since the original concept of .NET Standard was first suggested (and along with it a completely different model/architecture for mutli-targeting class libraries), we've struggled for some time to arrive at a go-forward strategy for Common.Logging that would be aligned with the future direction/architecture of the .NET platform vs. being (mostly) backward-facing and constrained by legacy design decisions being carried forward from years prior. Part of the delay in our plans to support .NET Standard had been the gap between the arrival of .NET Standard and the availability of proper tooling/Visual Studio support for the concepts it represents.
Now that we've reached a point where the tooling is able to properly support the concepts, we think we've arrived at a go-forward strategy for this aspect of the project. After review and consideration we're now leaning strongly towards the following approach to support .NET Standard in Common.Logging:
Common.Logging
3.4 will be the last release of the 3.x version branch (e.g., there will be no 3.5 release planned and we will only do 3.4.x bug-fix releases as needed for some limited time).Common.Logging
3.4 will be the last release ofCommon.Logging
to support the 'legacy' .NET Framework versions which fall below the floor established by .NET Standard 1.0 (e.g., < .NET 4.5).Common.Logging
4.0 will support only .NET Standard, leveraging the new multi-targeting capabilities introduced in Visual Studio 2017 and abandoning PCL support entirely. NOTE: given the differing availability of .NET APIs in each version of .NET Standard, we have not yet determined for certain the min. version of .NET Standard that will be supported byCommon.Logging
4.0. But it will at least target >= .NET Standard 1.0 and will not support any .NET Framework version that falls outside the scope of .NET Standard as defined here.Common.Logging
4.0 will support only Visual Studio 2017 as an IDE for building and contributing to the project. Support for building the project in legacy versions of Visual Studio will be dropped as they cannot support .NET Standard and the Community Version of Visual Studio 2017 is 100% free of charge and should be able to be used by adopters, contributors, etc. who desire to interact with the source code for the project.Given that most versions of the .NET Framework < .NET Standard 1.0 have already reached (or are about to) their effective end-of-life re: support from Microsoft, this above approach seems a reasonable decision to make at this time. That said, since this decision will effectively 'orphan' any users of
Common.Logging
that are still targeting < .NET 4.5 from having access to any new features and/or new loggers for which support were to be introduced, we wanted to offer this opportunity for users to offer comment/feedback before this approach is officially pursued.Thanks in advance for any and all input!
-The
Common.Logging
project teamThe text was updated successfully, but these errors were encountered: