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
Add support for identity-based connections to Diagnostic Events (#10438)
* Add support for identity-based connections to Diagnostic Events
* Updated release notes
* Removed unused namespace
* Ensure that the factory takes into account a configuration section and not only the connection string
* Logging failure to create the client as a warning and adapted message
* Update release_notes
Co-authored-by: Lilian Kasem <[email protected]>
* Address PR feedback
* Update release notes
---------
Co-authored-by: Lilian Kasem <[email protected]>
// The TableServiceClient only verifies the format of the connection string.
72
-
// To ensure the storage account exists and supports Table storage, validate the connection string by retrieving the properties of the table service.
73
-
_=_tableClient.GetProperties();
74
-
}
75
-
catch(Exceptionex)
76
-
{
77
-
_logger.LogError(ex,"The Azure Storage connection string is either empty or invalid. Unable to record diagnostic events, so the diagnostic logging service is being stopped.");
78
-
_isEnabled=false;
79
-
StopTimer();
80
-
}
64
+
_logger.LogWarning("An error occurred initializing the Table Storage Client. We are unable to record diagnostic events, so the diagnostic logging service is being stopped.");
Assert.Equal(messages[0].FormattedMessage,"The Azure Storage connection string is either empty or invalid. Unable to record diagnostic events, so the diagnostic logging service is being stopped.");
167
+
Assert.Equal(messages[0].FormattedMessage,"An error occurred initializing the Table Storage Client. We are unable to record diagnostic events, so the diagnostic logging service is being stopped.");
164
168
Assert.False(repository.IsEnabled());
165
169
}
166
170
@@ -171,7 +175,7 @@ public async Task QueueBackgroundDiagnosticsEventsTablePurge_PurgesTables()
repository.WriteDiagnosticEvent(DateTime.UtcNow,"eh1",LogLevel.Information,"This is the message","https://fwlink/",newException("exception message"));
@@ -278,7 +283,7 @@ public async Task FlushLogs_LogsErrorAndClearsEvents_WhenTableCreatingFails()
278
283
varlogMessage=_loggerProvider.GetAllLogMessages().SingleOrDefault(m =>m.FormattedMessage.Contains("Unable to get table reference"));
279
284
Assert.NotNull(logMessage);
280
285
281
-
varmessagePresent=_loggerProvider.GetAllLogMessages().Any(m =>m.FormattedMessage.Contains("The Azure Storage connection string is either empty or invalid. Unable to record diagnostic events, so the diagnostic logging service is being stopped."));
286
+
varmessagePresent=_loggerProvider.GetAllLogMessages().Any(m =>m.FormattedMessage.Contains("An error occurred initializing the Table Storage Client. We are unable to record diagnostic events, so the diagnostic logging service is being stopped."));
282
287
Assert.True(messagePresent);
283
288
284
289
Assert.Equal(0,repository.Events.Values.Count());
@@ -302,7 +307,7 @@ public async Task FlushLogs_OnPrimaryHost_PurgesPreviousEventVersionTables(strin
0 commit comments