public static void ConfigureExceptionHandler(this IApplicationBuilder app, ILoggerManager logger) { app.UseExceptionHandler(appError => { appError.Run(async context => { var contextFeature = context.Features.Get <IExceptionHandlerFeature>(); if (contextFeature != null) { await logger.LogExceptionAsync(contextFeature.Error); } }); }); }