-
Notifications
You must be signed in to change notification settings - Fork 868
Description
Description
As a .NET developer, I want to active SDK call response log to System.Diagnostics or to Console to log locally the responses to all SDK API calls when I'm debugging a .NET Core Web App.
I read carefully the documentation for .NET Core here https://docs.aws.amazon.com/sdk-for-net/latest/developer-guide/net-dg-config-netcore.html and added the following section to my appsettings.Development.json file :
"AWS": {
"LogResponse": true,
"LogMetrics": true,
"DisableLogging": false
}
At this point, I except to see in the console or in the Debug Window of Visual Studio the logs of the responses to AWS API.
From my exploration of the SDK, I discovered that setting the following properties of the AWSConfigs object in addition to adding the appsettings file section activates the log:
Amazon.AWSConfigs.LoggingConfig.LogResponses = Amazon.ResponseLoggingOption.Always;
Amazon.AWSConfigs.LoggingConfig.LogTo = Amazon.LoggingOptions.SystemDiagnostics;
Amazon.AWSConfigs.AddTraceListener("Amazon", new System.Diagnostics.ConsoleTraceListener());
Adding only
Amazon.AWSConfigs.AddTraceListener("Amazon", new System.Diagnostics.ConsoleTraceListener());
is not enough.
So is it a documentation issue or a code issue?
Reproduction Steps
In the main branch of this repository https://github.com/fbouteruche/AWSSDKCallLogWebAppSample, you will find a sample that demonstrates that adding the above section will not output any logs in the console or in the Debug window.
In the branch https://github.com/fbouteruche/AWSSDKCallLogWebAppSample/tree/workaround-to-enable-local-log, you will find a sample of the proposed workaround.
Logs
This issue is about log.
Environment
-
SDK Version:
- AWSSDK.Core 3.5.1.46
-
Package Version:
- AWSSDK.Extensions.NETCore.Setup 3.3.101
- AWSSDK.S3 3.5.6.2
-
OS Info: Windows 10
-
Build Environment: Visual Studio 2019 16.8.2
-
Targeted .NET Platform: netcoreapp3.1
Resolution
- 👋 I can/would-like-to implement a fix for this problem myself
This is a 🐛 bug-report