Skip to content

Commit 2a13931

Browse files
committed
removing duplicate Exception logging in ILogger
1 parent 47e87b6 commit 2a13931

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/WebJobs.Script/Host/ScriptHost.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ private Collection<FunctionMetadata> LoadProxyRoutes(string proxiesJson)
11781178
{
11791179
_proxyClient = new ProxyClientExecutor(rawProxyClient);
11801180
}
1181-
}
1181+
}
11821182

11831183
if (_proxyClient == null)
11841184
{
@@ -1733,7 +1733,7 @@ private void HandleHostError(Exception exception)
17331733
TraceWriter.Error(message, exception);
17341734
TraceWriter.Flush();
17351735

1736-
Logger?.LogError(0, exception, message);
1736+
// Note: We do not log to ILogger here as any error has already been logged.
17371737

17381738
if (exception is FunctionInvocationException)
17391739
{

test/WebJobs.Script.Tests.Integration/ApplicationInsights/ApplicationInsightsEndToEndTestsBase.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,11 @@ private string ValidateEndToEndTest(string functionName, string functionTrace, b
183183

184184
ValidateTrace(errorTrace, $"Exception while executing function: Functions.{functionName}.", LogCategories.Executor, functionName, invocationId, SeverityLevel.Error);
185185

186-
ExceptionTelemetry[] exception = _fixture.Channel.Telemetries
186+
ExceptionTelemetry exception = _fixture.Channel.Telemetries
187187
.OfType<ExceptionTelemetry>()
188-
.Where(t => t.Context.Operation.Id == invocationId)
189-
.OrderBy(t => t.Message)
190-
.ToArray();
191-
192-
// We should only be logging one Exception. Tracked by https://github.com/Azure/azure-webjobs-sdk-script/issues/1830
193-
Assert.Equal(2, exception.Length);
188+
.Single(t => t.Context.Operation.Id == invocationId);
194189

195-
ValidateException(exception[0], invocationId, functionName, LogCategories.Results);
196-
ValidateException(exception[1], invocationId, functionName, ScriptConstants.LogCategoryHostGeneral);
190+
ValidateException(exception, invocationId, functionName, LogCategories.Results);
197191
}
198192

199193
RequestTelemetry requestTelemetry = _fixture.Channel.Telemetries

0 commit comments

Comments
 (0)