-
Hi, how do I set the logging level for the mock test tool. I see when it loads it in my windows CMD window:
I would like to set the level to debug instead of information. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
@mleziva Thanks for opening discussion. Please refer to Lambda function logging in C#. The environment variable From https://github.com/aws/aws-lambda-dotnet/tree/master/Tools/LambdaTestTool,
{
"profiles": {
"Mock Lambda Test Tool": {
"commandName": "Executable",
"commandLineArgs": "--port 5050",
"workingDirectory": ".\\bin\\$(Configuration)\\net6.0",
"executablePath": "%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-6.0.exe",
"environmentVariables": {
"AWS_LAMBDA_HANDLER_LOG_LEVEL": "Debug",
"LAMBDA_NET_SERIALIZER_DEBUG": "true"
}
}
}
}
{
"Information": [
"This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.",
"To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.",
"dotnet lambda help",
"All the command line options for the Lambda command can be specified in this file."
],
"profile": "default",
"region": "us-east-1",
"configuration": "Release",
"function-architecture": "x86_64",
"function-runtime": "dotnet6",
"function-memory-size": 256,
"function-timeout": 30,
"function-handler": "<<some-handler>>",
"environment-variables": "\"AWS_LAMBDA_HANDLER_LOG_LEVEL\"=\"Debug\";\"LAMBDA_NET_SERIALIZER_DEBUG\"=\"true\""
} Please let me know if this works for you. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hi Ashish, thanks for the quick reply. Unfortunately, that did not work for my local debugging environment. The output in the cmd window still returns the below
I can see the Log Output in the test function window is also only returning informational logging, not debug level Here is my launchsettings.json
|
Beta Was this translation helpful? Give feedback.
-
Hi Ashish, Thanks for pointing me in the right direction. I didn't realize the log level loaded output was part of this project, not the Mock Lambda Test Tool. This project is using Microsoft.Extensions.Logging and was setting the default log level in appsettings.json. I just needed to update what was specified there and now I see that debug logs are appearing as required. |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Hi Ashish,
Thanks for pointing me in the right direction. I didn't realize the log level loaded output was part of this project, not the Mock Lambda Test Tool. This project is using Microsoft.Extensions.Logging and was setting the default log level in appsettings.json. I just needed to update what was specified there and now I see that debug logs are appearing as required.