You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Newest version of Microsoft.Extensions.Logging.Abstractions requires too many dependencies #1106
Currently, the README states that the library has only one dependency - Microsoft.Extensions.Logging.Abstractions. However, this is only true if you use the 2.1.0 version of that library.
For my use case, I would like to use the most up-to-date version (currently 7.0.0) of the library for security/reliability reasons, but this would require 15+ more dependencies because of added dependencies for the newer versions. A solution to this would be much appreciated. Further, once Microsoft deprecates all older versions of the library, we will all run into this problem at some point.
Hi @gregoryjtom , good point but this was a new change in v40 requested by a number of people. See the v40 discussion here. #906
So essentially some users wanted to use standard logging libraries which we have never supported since day 1. v40 was a big change and it seemed like a good time to add that in. But the downside is we have a dependency on MELA which is unavoidable as we need the ILogger interface from it.
What do you suggest for a solution?
One idea: Publish 2 different nuget libraries. One which references MELA and one which does not.
FluentFTPLite will be just the pure library without any deps
FluentFTP will have MELA
(or flip the naming and make FluentFTP the plain one and FluentFTP.AnySuffix the MELA one - where AnySuffix must be decided)
@gregoryjtom what framework is your application targeting?
I've tried building a console program using VS2022 targeting net462, net48 and net6 and different versions of MELA to see what dlls are included in the bin folder.
MELA 2.1.0 & 2.2.0 & 3.1.0
net462:
101 dlls
net48:
*Microsoft.Extensions.Logging.Abstractions
net6:
Microsoft.Extensions.Logging.Abstractions
MELA 6.0.0 & 7.0.0:
net462 & net48:
Microsoft.Extensions.Logging.Abstractions
System.Buffers
System.Memory
System.Numerics.Vectors
System.Runtime.CompilerServices.Unsafe
net6:
Microsoft.Extensions.Logging.Abstractions
Without have done exhaustive experimentation it looks like if you use at least net48 you should not see 15+ dlls.
@robinrodricks
I would not recommend duplicating the core library in two packages.
From a consumer perspective it might make some confusion about the differences.
It makes it hard if having project dependencies A -> B -> C and some use FluentFtp and some FluentFtpLite.
(Your download count on nuget.org will be distributed between two packages, which might make it less visible.)
If you want to go with publishing multiple packages, I proposed in #906 (comment) to make logging using MELA an extension package such that you have
FluentFtp all ftp functionality and built-in logging
Fluent.Ftp.Logging a tiny package to help bridge between the built-in logging and MELA.
@jnyrup Wow that was fast. I like this implementation overall, especially how it eliminates the forced dep on MELA. How would one use this in practice?
new FtpClient(h, p, c, new MicrosoftLoggingAdapter(new Log4NetLogger())) ??
How would one use this in practice? new FtpClient(h, p, c, new MicrosoftLoggingAdapter(new Log4NetLogger())) ??
yes
Any suggested next steps @jnyrup or should I release?
Did you see the comments in my prototype in the .csproj file about how this should be done properly?
Activity
robinrodricks commentedon Dec 14, 2022
Hi @gregoryjtom , good point but this was a new change in v40 requested by a number of people. See the v40 discussion here. #906
So essentially some users wanted to use standard logging libraries which we have never supported since day 1. v40 was a big change and it seemed like a good time to add that in. But the downside is we have a dependency on MELA which is unavoidable as we need the
ILoggerinterface from it.What do you suggest for a solution?
One idea: Publish 2 different nuget libraries. One which references MELA and one which does not.
FluentFTPLitewill be just the pure library without any depsFluentFTPwill have MELA(or flip the naming and make
FluentFTPthe plain one andFluentFTP.AnySuffixthe MELA one - whereAnySuffixmust be decided)jnyrup commentedon Dec 22, 2022
@gregoryjtom what framework is your application targeting?
I've tried building a console program using VS2022 targeting net462, net48 and net6 and different versions of MELA to see what dlls are included in the bin folder.
*Microsoft.Extensions.Logging.Abstractions
Without have done exhaustive experimentation it looks like if you use at least net48 you should not see 15+ dlls.
@robinrodricks
I would not recommend duplicating the core library in two packages.
FluentFtpand someFluentFtpLite.If you want to go with publishing multiple packages, I proposed in #906 (comment) to make logging using MELA an extension package such that you have
FluentFtpall ftp functionality and built-in loggingFluent.Ftp.Logginga tiny package to help bridge between the built-in logging and MELA.robinrodricks commentedon Dec 22, 2022
Hi @jnyrup thanks for the testing and your comments. Yes I agree that we should not duplicate the core packages.
FluentFTP+FluentFTP.Loggingsounds like a good possibility if people don't want MELA always bundled.FanDjango commentedon Dec 22, 2022
I think that is a good idea. I have also run into this problem to a certain degree.
robinrodricks commentedon Dec 22, 2022
@jnyrup Any idea how these 2 packages would interact?
FluentFTPExposes some IFluentLoggerFluentFTP.Loggingimplements IFluentLogger and provides an implementation to it which also implementsMELA.ILogger?I'm finding it hard to understand what
FluentFTP.Loggerreally does here, apart from adding a ref to MELA package.jnyrup commentedon Dec 22, 2022
With help from https://stackoverflow.com/questions/5646820/logger-wrapper-best-practice/5646876#5646876 here's a prototype of how it could be structured.
jnyrup@5c248df
robinrodricks commentedon Dec 23, 2022
@jnyrup Wow that was fast. I like this implementation overall, especially how it eliminates the forced dep on MELA. How would one use this in practice?
new FtpClient(h, p, c, new MicrosoftLoggingAdapter(new Log4NetLogger()))??robinrodricks commentedon Dec 23, 2022
Merged into master. Any suggested next steps @jnyrup or should I release? @FanDjango you want to play with it before release?
jnyrup commentedon Dec 23, 2022
yes
FluentFTP/FluentFTP.Logging/FluentFTP.Logging.csproj
Lines 9 to 16 in 7a40a73
FanDjango commentedon Dec 23, 2022
@jnyrup @robinrodricks
I've played with it. Yippee... no more MELA to be distributed along with my application - I tested the case where I am not using it.
This is worthy of a release. Needs doc in Wiki of course, this change so soon after V40 introduction of external logging.
robinrodricks commentedon Dec 23, 2022
Great.
Why not. Most people would not have used MELA anyway.
Yes but thanks for the reminder.
robinrodricks commentedon Dec 25, 2022
Published v43. I have wait for Nuget to update then I can publish the first version of
FluentFTP.Logging43.0.0
FtpClient.Loggeris no longer a MELAILoggerFtpClient.Loggeris now a custom interface calledIFtpLoggerrobinrodricks commentedon Dec 25, 2022
Done.
Published - https://www.nuget.org/packages/FluentFTP.Logging/1.0.0
Wiki updated - https://github.com/robinrodricks/FluentFTP/wiki/Logging
Code updated - https://github.com/robinrodricks/FluentFTP/wiki/Logging#how-do-i-log-all-ftp-commands-to-a-file-for-debugging
Guide updated - https://github.com/robinrodricks/FluentFTP/wiki/v40-Migration-Guide#6-use-the-new-logging-system
Thanks @jnyrup for the help/suggestion.
robinrodricks commentedon Dec 26, 2022
I am closing this issue. If further issues arise with logging, please file a new issue.
Thanks all.