Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

remove autocollection of userId from Log4Net #158

Merged
merged 2 commits into from
Feb 27, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Changelog

### Version 2.6.0-beta

### Version 2.6.0-beta1
- Include NLog GlobalDiagnosticsContext properties.
- Remove automatic collection of User Id (https://github.com/Microsoft/ApplicationInsights-dotnet-logging/issues/153)

### Version 2.5.0
- Update Application Insights API reference to [2.5.0]
Expand Down
3 changes: 2 additions & 1 deletion Logging.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
VisualStudioVersion = 15.0.27130.2036
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EE933574-C82B-4E59-A0D1-05328197B937}"
EndProject
Expand All @@ -13,6 +13,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xdt.Tests", "test\Xdt.Tests
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{117E14CF-5656-42BD-B64E-93142160B6FA}"
ProjectSection(SolutionItems) = preProject
CHANGELOG.md = CHANGELOG.md
CodeCov.ps1 = CodeCov.ps1
Common.props = Common.props
Common.targets = Common.targets
Expand Down
1 change: 0 additions & 1 deletion src/Log4NetAppender/ApplicationInsightsAppender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ private void SendTrace(LoggingEvent loggingEvent)
private void BuildCustomProperties(LoggingEvent loggingEvent, ITelemetry trace)
{
trace.Timestamp = loggingEvent.TimeStamp;
trace.Context.User.AuthenticatedUserId = loggingEvent.UserName;

IDictionary<string, string> metaData;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,7 @@ public void TelemetryIsAcceptedByValidateEndpoint()

Assert.IsNull(TelemetrySender.ValidateEndpointSend(telemetry));
}

[TestMethod]
[TestCategory("Log4NetAppender")]
public void Log4NetSetsAuthenticatedUser()
Copy link
Member

Choose a reason for hiding this comment

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

Would you mind changing this test into Log4NetDoesNotSetAuthenticatedUser() rather than remove it?
With this we will enforce this new requirement we've got.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense. Done.

{
this.appendableLogger.Logger.Debug("Trace Debug");

var sentItems = this.appendableLogger.SentItems;
Assert.AreEqual(1, sentItems.Length);

var telemetry = (TraceTelemetry)sentItems[0];
Assert.IsNotNull(telemetry.Context.User.AuthenticatedUserId);
}


[TestMethod]
[TestCategory("Log4NetAppender")]
public void Log4NetAddsCustomProperties()
Expand Down