Sitelet https://github.com/microsoft/ApplicationInsights-dotnet-logging/pull/167#event-1556889615
Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

NLog + log4net added NetStandard support - #167

Merged
Sergey Kanzhelev (SergeyKanzhelev) merged 4 commits into
microsoft:developfrom
snakefoot:develop
Apr 4, 2018
Merged

Sergey Kanzhelev (SergeyKanzhelev) merged 4 commits into
microsoft:developfrom
snakefoot:develop

Conversation

@snakefoot

@snakefoot Rolf Kristensen (snakefoot) commented Apr 1, 2018 •

Copy link
Copy Markdown
Contributor

Updated to NLog ver. 4.5.0 RTM
Updated to log4net ver. 2.0.8 RTM

Added support for Flush()

Resolves #155 + Resolves #68 + Resolves #115

@msftclas

Microsoft Contribution License Agreements (msftclas) commented Apr 1, 2018 •

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

@snakefoot
Rolf Kristensen (snakefoot) force-pushed the develop branch 4 times, most recently from 514e768 to 2d5e2b1 Compare April 1, 2018 21:57

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contribution! Please see comments in my review

</PackageReference>
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.6.0-beta2" />
<PackageReference Include="log4net" Version="2.0.5" />
<PackageReference Include="log4net" Version="2.0.8" />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this update required for the PR? Can the older version reference be kept for better compatibility?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see... older version doesn't have netstandard target.

Can you please enable optional reference here - older version for net45 and newer fro netstandard.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now only using ver. 2.0.8 for netstandard, but I have to force log4net from 2.0.5 to 2.0.6 on net45 to support flush.

Comment thread src/NLogTarget/NLogTarget.csproj Outdated
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>

<TargetFrameworks>net45</TargetFrameworks>
<TargetFrameworks>netstandard1.3;net45</TargetFrameworks>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the new target there should be corresponding test project. It will be basically a copy paste of net45. We copying them as Visual Studio test explorer doesn't understand yet multiuple target platfgorms in a single test project.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have added netcore-unit-test-projects for NLog and log4net

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again! I'll merge if there will be no more feedback by tomorrow.

@cijothomas Cijo Thomas (cijothomas) left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing!
Can you please update changelog as well with a one liner describing this change/link to GH issue.
https://github.com/Microsoft/ApplicationInsights-dotnet-logging/blob/develop/CHANGELOG.md

@snakefoot

Copy link
Copy Markdown
Contributor Author

Cijo Thomas (@cijothomas) Updated changelog.md with a 3 liner


IDictionary<string, string> propertyBag;

if (trace is ExceptionTelemetry)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it help to use the ISupportProperties interface here? i.e.

propertyBag = ((ISupportProperties)trace).Properties;

@snakefoot Rolf Kristensen (snakefoot) Apr 2, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just moving code around (stylecop) to fix the unit tests (No PrivateObject in NetCore)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Fine to leave it as it is, then.


if (!string.IsNullOrEmpty(logEvent.LoggerName))
{
propertyBag.Add("LoggerName", logEvent.LoggerName);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider nameof(logEvent.LoggerName)

@snakefoot Rolf Kristensen (snakefoot) Apr 2, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just moving code around (stylecop) to fix the unit tests (No PrivateObject in NetCore)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine to leave it as it is, then.

Comment thread CHANGELOG.md
### Version 2.6.0-beta3
- [NetStandard Support for NLog and log4net](https://github.com/Microsoft/ApplicationInsights-dotnet-logging/pull/167)
- [NLog and log4net can Flush](https://github.com/Microsoft/ApplicationInsights-dotnet-logging/pull/167)
- Update log4net reference to [2.0.6](https://www.nuget.org/packages/log4net/2.0.6)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're here, please could you also add a line indicating that we also added .Net Standard support for TraceListener:

- [NetStandard Support for TraceListener](https://github.com/Microsoft/ApplicationInsights-dotnet-logging/pull/166)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@304NotModified

Copy link
Copy Markdown

When will this be released?

Thanks in advance!

@SergeyKanzhelev

Copy link
Copy Markdown
Contributor

@MS-TimothyMothra is working on next beta as we speak. Timothy, can you confirm the estimated date of this release?

@TimothyMothra

Copy link
Copy Markdown

Earliest will be end of next week (Apr 13th) maybe slipping to early the week of the 16th.

This release is dependent on dotnet and dotnet-server. Those are in progress now and should be finished early-mid next week. (Apr 9-11).

@snakefoot

Copy link
Copy Markdown
Contributor Author

Microsoft.ApplicationInsights.NLogTarget ver. 2.6.0-beta3 has been released:

https://www.nuget.org/packages/Microsoft.ApplicationInsights.NLogTarget/2.6.0-beta3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants