Skip to content

Instantly share code, notes, and snippets.

@mirmostafa
Created September 4, 2021 06:24
Show Gist options
  • Save mirmostafa/23284bfd5bd69a8eebfd2c0f2d3a2067 to your computer and use it in GitHub Desktop.
Save mirmostafa/23284bfd5bd69a8eebfd2c0f2d3a2067 to your computer and use it in GitHub Desktop.
Setup logger
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.2" />
<PackageReference Include="Serilog.Extensions.Logging.File" Version="2.0.0" />
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.AddDebug().AddConsole();
logging.AddFilter("", LogLevel.Information)
.AddFilter("Microsoft.AspNetCore.Routing.EndpointMiddleware", LogLevel.Warning)
.AddFilter("Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker", LogLevel.Warning)
.AddFilter("Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor", LogLevel.Warning);
})
.UseStartup<Startup>()
//.UseIIS().UseUrls("http://*:5000");
.UseKestrel(option => option.Listen(IPAddress.Loopback, 5000));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment