Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

329
Vistas
Reducing HttpClient log verbosity

I'm currently writing a .NET 6 application which makes some REST calls.

For some reason, when these calls are made, HttpClient is logging the following:

[15:33:15 INF] Start processing HTTP request GET URL_GOES_HERE
[15:33:15 INF] Sending HTTP request GET URL_GOES_HERE
[15:33:15 INF] Received HTTP response headers after 70.5393ms - 200
[15:33:15 INF] End processing HTTP request after 73.441ms - 200

Due to the number of calls I'm making, this is making my logging platform hard to navigate.

I can't find any documentation online as to how I'd go about muting these logs. They seem to be new to .NET 6? At least I haven't seen them before starting this new project.

I found this github repo which solves this problem, however, I'd rather not pull a third-party package in just to silence some logs.

I have other "information" level logs in my application, meaning I'm unable to suppress the entire level.

Is there really no native way to silence these logs from HttpClient?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Log settings are set in your appsettings.json file (or the appsettings.development.json file):

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

Changing the Default to "Warning" or "Error" (or higher) will remove the lower-level messages (such as the Information messages you are getting).

over 4 years ago · Santiago Trujillo Denunciar

0

I managed to exclude these logs using Serilog, which I was already using in the application.

When setting up the LoggerConfiguration, you can apply "filters", like so:

Log.Logger = new LoggerConfiguration()
    .Filter.ByExcluding("SourceContext like '%System.Net.Http.HttpClient%' and @l = 'Information'")
    .CreateLogger();
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda