Skip to content

Common.Logging.NLog not available for net core #147

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

Closed
jwaimann opened this issue Jun 7, 2017 · 4 comments
Closed

Common.Logging.NLog not available for net core #147

jwaimann opened this issue Jun 7, 2017 · 4 comments

Comments

@jwaimann
Copy link

jwaimann commented Jun 7, 2017

I'm currently using Common.Logging version 3.4.0-beta2 and NLog 5.0.0-beta07 on netcoreapp1.1.
I cannot find Common.Logging.NLog specific version for that case.

In case it is not yet available, which log file option do I have as adapter for net core?

Thanks in advance.

@LHCGreg
Copy link

LHCGreg commented Jul 8, 2017

@jwaimann : What I did is create an NLog adapter compatible with netstandard. See https://github.com/LHCGreg/animerecs/tree/589ff87/Common.Logging.NLogNetStandard. I just had to take the files that Common.Logging.NLog444 uses, make two modifications, and reference NLog 5.0.0-beta09 and Common.Logging 3.4.0-Beta2.

The two modifications were:

  • Remove NLogLoggerFactoryAdapter constructor that takes a System.Collections.Specialized.NameValueCollection, as that type is not present in netstandard. I didn't bother with #if'ing that constructor since the code is just for me.

  • In NLogLoggerFactoryAdapter constructor, use AppContext.BaseDirectory instead of AppDomain.CurrentDomain.BaseDirectory because AppDomain does not exist in netstandard. If targeting the full .NET framework, AppContext requires .NET 4.6, so this also would have to be #if'ed to make it suitable for an official package.

I'd submit a PR but I'm not sure how the maintainers want to do multitargeting. Using the new csproj project style ("SDK style") would allow much easier multitargeting than the current setup with .DotNetCore, .Silverlight, etc projects.

@sbohlen
Copy link
Member

sbohlen commented Jul 15, 2017

See #148 for our intended approach to this. Would be interested in feedback from everyone on this thread/issue.

@sbohlen
Copy link
Member

sbohlen commented Aug 1, 2017

Closing this issue as superseded by #148.

@sbohlen sbohlen closed this as completed Aug 1, 2017
@snakefoot
Copy link

Created PR #176 for resolving this. (Includes custom build of nuget-package as attachment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants