I have created a sample .NET 6 console application and added the below line of code as mentioned in the below Microsoft learn website to enable azure sdk client library logs.
using AzureEventSourceListener consoleListener =
AzureEventSourceListener.CreateConsoleLogger(System.Diagnostics.Tracing.EventLevel.Verbose);
In the sample application I am downloading a blob using BlobClient which is defined in the "Azure.Storage.Blobs" nuget package. And also I am sending a cloud to device message using ServiceClient which is defined in the "Microsoft.Azure.Devices" nuget package.
For the blob client operation I am able to get the sdk logs in console, but for cloud to device message operation using "ServiceClient" I am not able to get the sdk logs.
The sdk logs for the blob operation which is logged in console is attached.
Similar log for service client operation is not logged
Could you please help me in getting the sdk logs in console for "Microsoft.Azure.Devices" library
Here is my code
using AzureEventSourceListener consoleListener = AzureEventSourceListener.CreateConsoleLogger(System.Diagnostics.Tracing.EventLevel.Verbose);
var x = new BlobClient(new Uri("BLOB URL")).Download();
ServiceClient _serviceClient = ServiceClient.CreateFromConnectionString("CONN STRING");
string msg = "Hi Qwerty";
Message message = new Message(Encoding.ASCII.GetBytes(msg));
await _serviceClient.SendAsync("DEVICE ID", message);
Install the below packages
Output:
Microsoft.Azure.Devices.Clientfrom this reference MSDOC