Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

suppressing Microsoft.AspnetCore Console logging #10961


User avatar
0
sedulen created

Prerequisites

Please answer the following questions before submitting an issue.

  • What is your product version? v9.3.0
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net core 3.1

If issue related with ABP Framework

  • What is ABP Framework version? v5.14.0

How have others handled the Microsoft.AspnetCore logging? I am using a ANZ v9.3.0 and ABP v5.14.0 and I haven't changed anything with how the logging frameworks work. Inside of my log4net.config file I have a RemoteSyslogAppender defined

However, when I deploy to my docker container, I still see a lot of logging that is going to the Console.

sedulen_api_1 | 2022-03-14 14:18:08,356 [13] INFO Microsoft.AspNetCore.Hosting.Diagnostics [(null)] - Request starting HTTP/1.1 GET http://localhost/AbpUserConfiguration/GetAll sedulen_api_1 | 2022-03-14 14:18:08,469 [13] INFO Microsoft.AspNetCore.Routing.EndpointMiddleware [(null)] - Executing endpoint 'Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore)' sedulen_api_1 | 2022-03-14 14:18:08,566 [13] INFO Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker [(null)] - Route matched with {action = "GetAll", controller = "AbpUserConfiguration", area = ""}. Executing controller action with signature System.Threading.Tasks.Task'1[Microsoft.AspNetCore.Mvc.JsonResult] GetAll() on controller Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController (Abp.AspNetCore). sedulen_api_1 | 2022-03-14 14:18:09,015 [13] INFO Microsoft.AspNetCore.Mvc.NewtonsoftJson.NewtonsoftJsonResultExecutor [(null)] - Executing JsonResult, writing value of type 'Abp.Web.Models.AjaxResponse'. sedulen_api_1 | 2022-03-14 14:18:09,082 [12] INFO Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker [(null)] - Executed action Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore) in 513.3897ms sedulen_api_1 | 2022-03-14 14:18:09,083 [12] INFO Microsoft.AspNetCore.Routing.EndpointMiddleware [(null)] - Executed endpoint 'Abp.AspNetCore.Mvc.Controllers.AbpUserConfigurationController.GetAll (Abp.AspNetCore)' sedulen_api_1 | 2022-03-14 14:18:09,089 [12] INFO Microsoft.AspNetCore.Hosting.Diagnostics [(null)] - Request finished in 732.9607ms 200 application/json; charset=utf-8

Has anyone identified a way to shut this off ? I don't have any Console logging configured, but I'm still seeing this logging in my docker container console output, and when I run a load test, I am seeing performance issues in my dump files relating to a ConsoleLogger.

Any thoughts or suggestions is greatly appreciated. Thanks everyone! -Brian


2 Answer(s)
  • User Avatar
    0
    hra created

    Hi @sedulen,

    I had similar issues suppressing this logging. Finally I found configuring it in code during creation of the WebHost worked (in my Web.Host project)

    Here's mine...

    public static IWebHostBuilder CreateWebHostBuilder(string[] args)
    {
        return new WebHostBuilder()
            .UseKestrel(opt =>
            {
                opt.AddServerHeader = false;
                opt.Limits.MaxRequestLineSize = 16 * 1024;
            })
            .UseContentRoot(Directory.GetCurrentDirectory())
            .UseIIS()
            .UseIISIntegration()
            .ConfigureLogging(logging =>
            {
                logging.AddFilter("Microsoft.AspNetCore.SignalR", LogLevel.Warning);
                logging.AddFilter("Microsoft.AspNetCore.Http.Connections", LogLevel.Warning);
                logging.AddFilter("Microsoft.AspNetCore.Hosting.Diagnostics", LogLevel.Warning);
                logging.AddFilter("Microsoft.AspNetCore.Routing.EndpointMiddleware", LogLevel.Warning);
                logging.AddFilter("Abp.AspNetCore.SignalR.Hubs.AbpCommonHub", LogLevel.Warning);
                logging.AddFilter("Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor", LogLevel.Warning);
                logging.AddFilter("Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler", LogLevel.Warning);
                logging.AddFilter("Microsoft.AspNetCore.Cors.Infrastructure.CorsService", LogLevel.Warning);
            })
            .UseStartup<Startup>();
    }
    
  • User Avatar
    0
    sedulen created

    awesome. thanks @hra !