-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Aspire .Net usage #771
Comments
Looking at your code snippet, you've configured logging for the client calls, but you haven't changed the logging settings for the servers themselves? I haven't used appHost.Services.AddLogging((builder) => builder.AddXUnit(logger)) |
sorry I may not understand... the snippet I sent was from the [Fact], sorry I'm not pro'ed on github markup... in the unit test the appHost is setup simply: inside the Fact I am adding to the appHost: inside the web application I still see the messages that I have coded to log, as you normally would in the structured logs. As you know, when using Xunit you don't get to see them in the unit tests like you did using Microsoft Test. I thought adding this code would let the ITestOutputHelper be used as the logger in the webapp so I'd see the logs in the unit test. but... if you have not yet tried Aspire I can understand that is might be difficult to grasp with the crummy snipets :). Sorry... I guess it just won't do what I had hoped at this time. |
Your code snippet makes it looks like you're adding xunit to the client logging - but you're not adding it to the logging of your services. My snippet is a suggestion of how to do that. |
I think I see what you mean. I thought the chained call would still work. I made this change. appHost.Services.AddLogging((builder) => builder.AddXUnit(logger));
appHost.Services.ConfigureHttpClientDefaults(clientBuilder =>
{
clientBuilder.AddStandardResilienceHandler();
}); I still only see the logger from inside the [Fact]. For some reason this does not replace the logger created by the IDistributedApplicationTestingBuilder. bummer. Meaning logging from inside the API method is never seen. I do appreciate you getting back to me. |
Is your feature request related to a problem?
It could be I just don't know how to effectively use the package.
I am trying to set this up for an aspire xunit test. These use the IDistributedApplicationTestingBuilder.
I have a logger message in the /weather service call and one in the unit test itself. I see the later message but never the one inside the server call.
Describe the solution you'd like
Describe alternatives you've considered
None
Additional context
The text was updated successfully, but these errors were encountered: