Skip to content

Update default log level #1970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 7, 2025
Merged

Update default log level #1970

merged 7 commits into from
Feb 7, 2025

Conversation

GarrettBeatty
Copy link
Contributor

@GarrettBeatty GarrettBeatty commented Feb 5, 2025

Issue #, if available: DOTNET-7954

Description of changes:

  1. Change default log level in production to ERROR
  2. Change default log level when debugging to INFORMATION

Testing

  1. I ran in debug mode and verified that I only see INFO logs and no longer see the debug logs from Microsoft ASP Core.
  2. I ran the built dll/nuget and ran it from aspire and verified that i only see ERROR and console.writeline,console.error.writelien logs

image

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@GarrettBeatty GarrettBeatty marked this pull request as ready for review February 5, 2025 17:31
@normj
Copy link
Member

normj commented Feb 5, 2025

I tried it locally and got the same experience as you but strange enough when I then use your version through the Aspire integrations I'm still get the INFO messages. I'm looking into why this is.

@GarrettBeatty
Copy link
Contributor Author

I tried it locally and got the same experience as you but strange enough when I then use your version through the Aspire integrations I'm still get the INFO messages. I'm looking into why this is.

I also tried in aspire but see the same output that I have in the PR description. What extra info messages are you seeing?

@GarrettBeatty GarrettBeatty changed the base branch from master to dev February 5, 2025 21:23
@normj
Copy link
Member

normj commented Feb 5, 2025

I tried it locally and got the same experience as you but strange enough when I then use your version through the Aspire integrations I'm still get the INFO messages. I'm looking into why this is.

I also tried in aspire but see the same output that I have in the PR description. What extra info messages are you seeing?

I'm seeing this but maybe I have something installed in a bad way. I'm also have changes in my Aspire branch that could be causing problems.

2025-02-05T13:52:23 info: Microsoft.Hosting.Lifetime[14]
2025-02-05T13:52:23       Now listening on: http://localhost:52965/
2025-02-05T13:52:23 info: Microsoft.Hosting.Lifetime[0]
2025-02-05T13:52:23       Application started. Press Ctrl+C to shut down.
2025-02-05T13:52:23 info: Microsoft.Hosting.Lifetime[0]
2025-02-05T13:52:23       Hosting environment: Production
2025-02-05T13:52:23 info: Microsoft.Hosting.Lifetime[0]
2025-02-05T13:52:23       Content root path: C:\codebase\integrations-on-dotnet-aspire-for-aws\playground\Lambda\Lambda.AppHost
2025-02-05T13:52:45 -----------------------------------
2025-02-05T13:52:45 Next invocation returned: 000000000001
2025-02-05T13:52:45 -----------------------------------
2025-02-05T13:52:45 Response for request 000000000001
2025-02-05T13:52:45 "HELLO"

@GarrettBeatty
Copy link
Contributor Author

GarrettBeatty commented Feb 6, 2025

I tried it locally and got the same experience as you but strange enough when I then use your version through the Aspire integrations I'm still get the INFO messages. I'm looking into why this is.

I also tried in aspire but see the same output that I have in the PR description. What extra info messages are you seeing?

I'm seeing this but maybe I have something installed in a bad way. I'm also have changes in my Aspire branch that could be causing problems.

2025-02-05T13:52:23 info: Microsoft.Hosting.Lifetime[14]
2025-02-05T13:52:23       Now listening on: http://localhost:52965/
2025-02-05T13:52:23 info: Microsoft.Hosting.Lifetime[0]
2025-02-05T13:52:23       Application started. Press Ctrl+C to shut down.
2025-02-05T13:52:23 info: Microsoft.Hosting.Lifetime[0]
2025-02-05T13:52:23       Hosting environment: Production
2025-02-05T13:52:23 info: Microsoft.Hosting.Lifetime[0]
2025-02-05T13:52:23       Content root path: C:\codebase\integrations-on-dotnet-aspire-for-aws\playground\Lambda\Lambda.AppHost
2025-02-05T13:52:45 -----------------------------------
2025-02-05T13:52:45 Next invocation returned: 000000000001
2025-02-05T13:52:45 -----------------------------------
2025-02-05T13:52:45 Response for request 000000000001
2025-02-05T13:52:45 "HELLO"

Oh gotcha. I think I Am actually seeing this same behavior when running in aspire. Let me double check on this

@GarrettBeatty
Copy link
Contributor Author

GarrettBeatty commented Feb 6, 2025

I tried it locally and got the same experience as you but strange enough when I then use your version through the Aspire integrations I'm still get the INFO messages. I'm looking into why this is.

I also tried in aspire but see the same output that I have in the PR description. What extra info messages are you seeing?

I'm seeing this but maybe I have something installed in a bad way. I'm also have changes in my Aspire branch that could be causing problems.

2025-02-05T13:52:23 info: Microsoft.Hosting.Lifetime[14]
2025-02-05T13:52:23       Now listening on: http://localhost:52965/
2025-02-05T13:52:23 info: Microsoft.Hosting.Lifetime[0]
2025-02-05T13:52:23       Application started. Press Ctrl+C to shut down.
2025-02-05T13:52:23 info: Microsoft.Hosting.Lifetime[0]
2025-02-05T13:52:23       Hosting environment: Production
2025-02-05T13:52:23 info: Microsoft.Hosting.Lifetime[0]
2025-02-05T13:52:23       Content root path: C:\codebase\integrations-on-dotnet-aspire-for-aws\playground\Lambda\Lambda.AppHost
2025-02-05T13:52:45 -----------------------------------
2025-02-05T13:52:45 Next invocation returned: 000000000001
2025-02-05T13:52:45 -----------------------------------
2025-02-05T13:52:45 Response for request 000000000001
2025-02-05T13:52:45 "HELLO"

Oh gotcha. I think I Am actually seeing this same behavior when running in aspire. Let me double check on this

@normj should be fixed now. When i previously tested in aspire I was seeing INFO logs, but thought those were aspire logs (woops!). When i was testing standalone testtool v2, i actually installed the nuget package and ran from a current directory which had its own appsettings.json - it was using this by mistake and not actually reading the appsettings from the nuget package.

In the latest revision I updated the code to get the appsettings.json from the folder where the dll is installed. I also had to individually configure the test tool and api gateway builder to use this config. I also updated PR description with a screenshot showing it running in aspire

@GarrettBeatty GarrettBeatty marked this pull request as draft February 7, 2025 14:43
@GarrettBeatty GarrettBeatty marked this pull request as ready for review February 7, 2025 15:29
@@ -37,6 +39,17 @@ public static TestToolProcess Startup(RunCommandSettings settings, CancellationT
{
var builder = WebApplication.CreateBuilder();

builder.Services.AddSingleton(typeof(Assembly), typeof(ConfigurationSetup).Assembly);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Since this is a copy of the same code in ApiGatewayEmulatorProcess can you put it in a utility method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i made a Utils.ConfigureWebApplicationBuilder(builder); function. Didn't know what to call it so just called it ConfigureWebApplicationBuilder unless you have better naming idea

"Name": "Amazon.Lambda.TestTool",
"Type": "Patch",
"ChangelogMessages": [
"Update default log level"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could you be more descriptive here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@GarrettBeatty GarrettBeatty requested a review from normj February 7, 2025 19:54
@GarrettBeatty GarrettBeatty merged commit a57970b into dev Feb 7, 2025
5 checks passed
@GarrettBeatty GarrettBeatty deleted the gcbeatty/loglevel branch February 7, 2025 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants