Skip to content
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

Disable Diagnostics and Activity #18955

Closed
ladeak opened this issue Feb 11, 2020 · 2 comments
Closed

Disable Diagnostics and Activity #18955

ladeak opened this issue Feb 11, 2020 · 2 comments
Labels
area-hosting Includes Hosting area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Comments

@ladeak
Copy link
Contributor

ladeak commented Feb 11, 2020

[Question]

In ASP.NET Core 2 HostingApplicationDiagnostics only created Activity.Current if we manually subscribed DiagnosticsListener for events Microsoft.AspNetCore.Hosting.HttpRequestIn.

In ASP.NET Core 3.1 it seems the Activity.Current is always created. That means if I have a Request-Id in the header, it is being used by the Activity by default. Is there a way to opt-out this behavior (other than turning off logging)?

@benaadams
Copy link
Member

Switch off "Microsoft.AspNetCore.Hosting.Diagnostics" also need to do it for EventLog on Windows

e.g. appsettings.json

{
  "Logging": {
    "LogLevel": {
      "Default": "Warning",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information",

      "Microsoft.AspNetCore.Hosting.Diagnostics": "None"
    },
    "EventLog": {
      "LogLevel": {
        "Microsoft.AspNetCore.Hosting.Diagnostics": "None"
      }
    }
  },

@ladeak
Copy link
Contributor Author

ladeak commented Feb 11, 2020

Perfect. We use this in some of our tests, which expected Diagnostics off by default and turned on by us later by subscribing to DiagnosticsListener.

@ladeak ladeak closed this as completed Feb 11, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Mar 24, 2020
@amcasey amcasey added the area-hosting Includes Hosting label Jun 1, 2023
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-hosting Includes Hosting area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

No branches or pull requests

5 participants