From 48977d41f2cc3b56aae05729f9e0c744c5bb99bb Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Mon, 29 Mar 2021 13:18:00 +1000 Subject: [PATCH 01/13] Dev version bump [skip ci] --- src/Serilog.AspNetCore/Serilog.AspNetCore.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj b/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj index ae0a628..2902b02 100644 --- a/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj +++ b/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj @@ -2,7 +2,7 @@ Serilog support for ASP.NET Core logging - 4.1.0 + 4.1.1 Microsoft;Serilog Contributors netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0 true From bcf00889595b36ced77108356457553e8a20e231 Mon Sep 17 00:00:00 2001 From: Alan Cohen <34688558+acohenOT@users.noreply.github.com> Date: Thu, 27 May 2021 15:01:52 -0400 Subject: [PATCH 02/13] Add using statement to readme example `LogEventLevel.Information` requires `using Serilog.Events;` --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index af1fd2e..fe23720 100644 --- a/README.md +++ b/README.md @@ -201,6 +201,7 @@ To use this technique, first replace the initial `CreateLogger()` call with `Cre ```csharp using Serilog; +using Serilog.Events; public class Program { From 933a7e15bd028cdf776698c4968f7a633ff30161 Mon Sep 17 00:00:00 2001 From: Alan Cohen <34688558+acohenOT@users.noreply.github.com> Date: Thu, 27 May 2021 19:36:20 -0400 Subject: [PATCH 03/13] Add using statement to readme example Add missing statement. I missed this when doing PR #247 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index fe23720..139f24e 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ dotnet add package Serilog.AspNetCore ```csharp using Serilog; +using Serilog.Events; public class Program { From 76f4a513e0538418b829ff4ef266444351b726fa Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Fri, 13 Aug 2021 15:09:47 +1000 Subject: [PATCH 04/13] Fixes #256 - typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 139f24e..4636c62 100644 --- a/README.md +++ b/README.md @@ -198,7 +198,7 @@ The downside of initializing Serilog first is that services from the ASP.NET Cor To address this, Serilog supports two-stage initialization. An initial "bootstrap" logger is configured immediately when the program starts, and this is replaced by the fully-configured logger once the host has loaded. -To use this technique, first replace the initial `CreateLogger()` call with `CreateBoostrapLogger()`: +To use this technique, first replace the initial `CreateLogger()` call with `CreateBootstrapLogger()`: ```csharp using Serilog; From 8e91c9a1d11204fa3a56bd3c375f2ad8f7bc629d Mon Sep 17 00:00:00 2001 From: "Jie-Ren (Jarron) Shih" <1546735+jarronshih@users.noreply.github.com> Date: Thu, 11 Nov 2021 21:44:16 -0800 Subject: [PATCH 05/13] Use IHttpRequestFeature.Path in RequestLoggingMiddleware to log RequestPath (#265) Co-authored-by: Ivan Maximov --- .../AspNetCore/RequestLoggingMiddleware.cs | 12 ++++++++---- .../AspNetCore/RequestLoggingOptions.cs | 6 ++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Serilog.AspNetCore/AspNetCore/RequestLoggingMiddleware.cs b/src/Serilog.AspNetCore/AspNetCore/RequestLoggingMiddleware.cs index dee6a5d..cc2d84b 100644 --- a/src/Serilog.AspNetCore/AspNetCore/RequestLoggingMiddleware.cs +++ b/src/Serilog.AspNetCore/AspNetCore/RequestLoggingMiddleware.cs @@ -33,6 +33,7 @@ class RequestLoggingMiddleware readonly Action _enrichDiagnosticContext; readonly Func _getLevel; readonly ILogger _logger; + readonly bool _includeQueryInRequestPath; static readonly LogEventProperty[] NoProperties = new LogEventProperty[0]; public RequestLoggingMiddleware(RequestDelegate next, DiagnosticContext diagnosticContext, RequestLoggingOptions options) @@ -45,6 +46,7 @@ public RequestLoggingMiddleware(RequestDelegate next, DiagnosticContext diagnost _enrichDiagnosticContext = options.EnrichDiagnosticContext; _messageTemplate = new MessageTemplateParser().Parse(options.MessageTemplate); _logger = options.Logger?.ForContext(); + _includeQueryInRequestPath = options.IncludeQueryInRequestPath; } // ReSharper disable once UnusedMember.Global @@ -91,7 +93,7 @@ bool LogCompletion(HttpContext httpContext, DiagnosticContextCollector collector var properties = collectedProperties.Concat(new[] { new LogEventProperty("RequestMethod", new ScalarValue(httpContext.Request.Method)), - new LogEventProperty("RequestPath", new ScalarValue(GetPath(httpContext))), + new LogEventProperty("RequestPath", new ScalarValue(GetPath(httpContext, _includeQueryInRequestPath))), new LogEventProperty("StatusCode", new ScalarValue(statusCode)), new LogEventProperty("Elapsed", new ScalarValue(elapsedMs)) }); @@ -107,14 +109,16 @@ static double GetElapsedMilliseconds(long start, long stop) return (stop - start) * 1000 / (double)Stopwatch.Frequency; } - static string GetPath(HttpContext httpContext) + static string GetPath(HttpContext httpContext, bool includeQueryInRequestPath) { /* In some cases, like when running integration tests with WebApplicationFactory - the RawTarget returns an empty string instead of null, in that case we can't use + the Path returns an empty string instead of null, in that case we can't use ?? as fallback. */ - var requestPath = httpContext.Features.Get()?.RawTarget; + var requestPath = includeQueryInRequestPath + ? httpContext.Features.Get()?.RawTarget + : httpContext.Features.Get()?.Path; if (string.IsNullOrEmpty(requestPath)) { requestPath = httpContext.Request.Path.ToString(); diff --git a/src/Serilog.AspNetCore/AspNetCore/RequestLoggingOptions.cs b/src/Serilog.AspNetCore/AspNetCore/RequestLoggingOptions.cs index 8d86582..1c7b434 100644 --- a/src/Serilog.AspNetCore/AspNetCore/RequestLoggingOptions.cs +++ b/src/Serilog.AspNetCore/AspNetCore/RequestLoggingOptions.cs @@ -68,6 +68,12 @@ static LogEventLevel DefaultGetLevel(HttpContext ctx, double _, Exception ex) => /// public ILogger Logger { get; set; } + /// + /// Include the full URL query string in the RequestPath property + /// that is attached to request log events. The default is true. + /// + public bool IncludeQueryInRequestPath { get; set; } = true; + /// /// Constructor /// From 706c196b599bfb497ca15bbde7009f25d61ad21f Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Fri, 12 Nov 2021 16:11:53 +1000 Subject: [PATCH 06/13] Update publishing key --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index bf62293..2d7ff52 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,7 +12,7 @@ deploy: - provider: NuGet skip_symbols: true api_key: - secure: jZtLAmD4ALF9x1BZR1DiV3KhKlliWbzRUAw73xfMZaBsvz19123qLz2zw1+hPdcn + secure: U7I8Skf+EcC7PiqvLWpSzPqNhCg03cqDOi4OtAkb+ZelMlQj1YoKDX8r1pdQzy7H on: branch: /^(main|dev)$/ - provider: GitHub From 297b6a6bc072214e71089df58dcc301f19ab9d03 Mon Sep 17 00:00:00 2001 From: Joao Correia Date: Wed, 12 Jan 2022 13:40:40 +0000 Subject: [PATCH 07/13] Bump Serilog.Settings.Configuration to latest version (3.3.0) --- src/Serilog.AspNetCore/Serilog.AspNetCore.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj b/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj index 2902b02..35edf68 100644 --- a/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj +++ b/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj @@ -30,7 +30,7 @@ - + From bad1c2fd5b3c27d0749565545e6fc3551f7681ff Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Wed, 19 Jan 2022 14:12:44 +1000 Subject: [PATCH 08/13] Switching to contact links [skip ci] --- .github/ISSUE_TEMPLATE/usage-help.md | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/usage-help.md diff --git a/.github/ISSUE_TEMPLATE/usage-help.md b/.github/ISSUE_TEMPLATE/usage-help.md deleted file mode 100644 index 4e4db70..0000000 --- a/.github/ISSUE_TEMPLATE/usage-help.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -name: Usage help -about: Get help with using Serilog -title: '' -labels: invalid -assignees: '' - ---- - -Hi! 👋 - -The Serilog community wants you to have a great experience using Serilog. Unfortunately, only a handful of maintainers actively follow this repository, and our time is short, so we cannot answer usage questions posted here. - -Fortunately, a much larger group of people (including some of us) also watch and answer questions on the [`serilog` tag on Stack Overflow](https://stackoverflow.com/questions/tagged/serilog). - -Please head over to Stack Overflow, ask your question, and tag it with `serilog`. Thanks! ❤ From 83043f293249ffa7429d777ad15baee7e4466df3 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Wed, 19 Jan 2022 14:13:57 +1000 Subject: [PATCH 09/13] Include @augustoprioete's usage help link from serilog/serilog [skip ci] --- .github/ISSUE_TEMPLATE/config.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..a29de9a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,4 @@ +contact_links: + - name: Ask for help + url: https://github.com/serilog/serilog/wiki/Usage-help + about: Ask the community for help on how to use Serilog From 8ec6d5c022f413771b0408ac8e9a40d02fea3e4e Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Wed, 2 Feb 2022 12:50:12 +1000 Subject: [PATCH 10/13] Follow-up from #265 - don't include query in logged request path by default; bump major version --- src/Serilog.AspNetCore/AspNetCore/RequestLoggingOptions.cs | 4 ++-- src/Serilog.AspNetCore/Serilog.AspNetCore.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Serilog.AspNetCore/AspNetCore/RequestLoggingOptions.cs b/src/Serilog.AspNetCore/AspNetCore/RequestLoggingOptions.cs index 1c7b434..bd6fead 100644 --- a/src/Serilog.AspNetCore/AspNetCore/RequestLoggingOptions.cs +++ b/src/Serilog.AspNetCore/AspNetCore/RequestLoggingOptions.cs @@ -70,9 +70,9 @@ static LogEventLevel DefaultGetLevel(HttpContext ctx, double _, Exception ex) => /// /// Include the full URL query string in the RequestPath property - /// that is attached to request log events. The default is true. + /// that is attached to request log events. The default is false. /// - public bool IncludeQueryInRequestPath { get; set; } = true; + public bool IncludeQueryInRequestPath { get; set; } /// /// Constructor diff --git a/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj b/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj index 35edf68..9dff771 100644 --- a/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj +++ b/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj @@ -2,7 +2,7 @@ Serilog support for ASP.NET Core logging - 4.1.1 + 5.0.0 Microsoft;Serilog Contributors netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0 true From c54e5acb2e3ad9c9c696b978901b17f067b704a9 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Wed, 2 Feb 2022 12:51:27 +1000 Subject: [PATCH 11/13] We're bumping the major version; mark IWebHostBuilder extension methods as obsolete, so that we can eventually drop this from the package (IHostBuilder is the modern replacement). --- src/Serilog.AspNetCore/Serilog.AspNetCore.csproj | 4 ++++ src/Serilog.AspNetCore/SerilogWebHostBuilderExtensions.cs | 6 ++++++ .../SerilogWebHostBuilderExtensionsTests.cs | 3 +++ 3 files changed, 13 insertions(+) diff --git a/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj b/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj index 9dff771..fc87fc3 100644 --- a/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj +++ b/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj @@ -24,6 +24,10 @@ + + $(DefineConstants);HOSTBUILDER + + diff --git a/src/Serilog.AspNetCore/SerilogWebHostBuilderExtensions.cs b/src/Serilog.AspNetCore/SerilogWebHostBuilderExtensions.cs index ffc45b9..7de1bef 100644 --- a/src/Serilog.AspNetCore/SerilogWebHostBuilderExtensions.cs +++ b/src/Serilog.AspNetCore/SerilogWebHostBuilderExtensions.cs @@ -38,6 +38,9 @@ public static class SerilogWebHostBuilderExtensions /// WriteTo.Providers() configuration method, enabling other s to receive events. By /// default, only Serilog sinks will receive events. /// The web host builder. +#if HOSTBUILDER + [Obsolete("Prefer UseSerilog() on IHostBuilder")] +#endif public static IWebHostBuilder UseSerilog( this IWebHostBuilder builder, ILogger logger = null, @@ -83,6 +86,9 @@ public static IWebHostBuilder UseSerilog( /// the Microsoft.Extensions.Logging API. Normally, equivalent Serilog sinks are used in place of providers. Specify /// true to write events to all providers. /// The web host builder. +#if HOSTBUILDER + [Obsolete("Prefer UseSerilog() on IHostBuilder")] +#endif public static IWebHostBuilder UseSerilog( this IWebHostBuilder builder, Action configureLogger, diff --git a/test/Serilog.AspNetCore.Tests/SerilogWebHostBuilderExtensionsTests.cs b/test/Serilog.AspNetCore.Tests/SerilogWebHostBuilderExtensionsTests.cs index 6c12183..e3ba4a0 100644 --- a/test/Serilog.AspNetCore.Tests/SerilogWebHostBuilderExtensionsTests.cs +++ b/test/Serilog.AspNetCore.Tests/SerilogWebHostBuilderExtensionsTests.cs @@ -12,6 +12,9 @@ using Serilog.Filters; using Serilog.AspNetCore.Tests.Support; +// Newer frameworks provide IHostBuilder +#pragma warning disable CS0618 + namespace Serilog.AspNetCore.Tests { public class SerilogWebHostBuilderExtensionsTests : IClassFixture From c3456f7413d6f66581b918222de88797171e3703 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Wed, 2 Feb 2022 12:59:15 +1000 Subject: [PATCH 12/13] More dependency updates --- samples/Sample/logs/log-20220202.txt | 56 +++++++++++++++++++ .../Serilog.AspNetCore.csproj | 6 +- .../Serilog.AspNetCore.Tests.csproj | 4 +- 3 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 samples/Sample/logs/log-20220202.txt diff --git a/samples/Sample/logs/log-20220202.txt b/samples/Sample/logs/log-20220202.txt new file mode 100644 index 0000000..a209c7d --- /dev/null +++ b/samples/Sample/logs/log-20220202.txt @@ -0,0 +1,56 @@ +2022-02-02 12:58:38.404 +10:00 [INF] Now listening on: https://localhost:5001 +2022-02-02 12:58:38.429 +10:00 [INF] Now listening on: http://localhost:5000 +2022-02-02 12:58:38.430 +10:00 [INF] Application started. Press Ctrl+C to shut down. +2022-02-02 12:58:38.430 +10:00 [INF] Hosting environment: Development +2022-02-02 12:58:38.431 +10:00 [INF] Content root path: C:\Development\nblumhardt\serilog-aspnetcore\samples\Sample +2022-02-02 12:58:45.038 +10:00 [INF] Hello, world! +2022-02-02 12:58:45.132 +10:00 [INF] HTTP GET / responded 200 in 134.6222 ms +2022-02-02 12:58:47.028 +10:00 [INF] Hello, world! +2022-02-02 12:58:47.031 +10:00 [INF] HTTP GET / responded 200 in 3.5411 ms +2022-02-02 12:58:48.217 +10:00 [ERR] HTTP GET /Home/Privacy responded 500 in 3.4740 ms +System.InvalidOperationException: Something went wrong. + at Sample.Controllers.HomeController.Privacy() in C:\Development\nblumhardt\serilog-aspnetcore\samples\Sample\Controllers\HomeController.cs:line 38 + at lambda_method17(Closure , Object , Object[] ) + at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync() + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() +--- End of stack trace from previous location --- + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() +--- End of stack trace from previous location --- + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() +--- End of stack trace from previous location --- + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) + at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) + at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) + at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext) in C:\Development\nblumhardt\serilog-aspnetcore\src\Serilog.AspNetCore\AspNetCore\RequestLoggingMiddleware.cs:line 62 +2022-02-02 12:58:48.259 +10:00 [ERR] An unhandled exception has occurred while executing the request. +System.InvalidOperationException: Something went wrong. + at Sample.Controllers.HomeController.Privacy() in C:\Development\nblumhardt\serilog-aspnetcore\samples\Sample\Controllers\HomeController.cs:line 38 + at lambda_method17(Closure , Object , Object[] ) + at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync() + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() +--- End of stack trace from previous location --- + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() +--- End of stack trace from previous location --- + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() +--- End of stack trace from previous location --- + at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) + at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) + at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) + at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext) in C:\Development\nblumhardt\serilog-aspnetcore\src\Serilog.AspNetCore\AspNetCore\RequestLoggingMiddleware.cs:line 62 + at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context) +2022-02-02 12:58:58.353 +10:00 [INF] Application is shutting down... +2022-02-02 12:58:58.379 +10:00 [INF] Stopped cleanly diff --git a/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj b/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj index fc87fc3..c6ca09e 100644 --- a/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj +++ b/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj @@ -30,9 +30,9 @@ - - - + + + diff --git a/test/Serilog.AspNetCore.Tests/Serilog.AspNetCore.Tests.csproj b/test/Serilog.AspNetCore.Tests/Serilog.AspNetCore.Tests.csproj index 2aff90a..c229883 100644 --- a/test/Serilog.AspNetCore.Tests/Serilog.AspNetCore.Tests.csproj +++ b/test/Serilog.AspNetCore.Tests/Serilog.AspNetCore.Tests.csproj @@ -14,8 +14,8 @@ - - + + From d9e072eb0a490ef4c8492c2d53c835131d4fc0b3 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Mon, 7 Feb 2022 11:06:50 +1000 Subject: [PATCH 13/13] Delete and ignore sample log output --- .gitignore | 3 ++ samples/Sample/logs/log-20210214.txt | 56 ---------------------------- samples/Sample/logs/log-20220202.txt | 56 ---------------------------- 3 files changed, 3 insertions(+), 112 deletions(-) delete mode 100644 samples/Sample/logs/log-20210214.txt delete mode 100644 samples/Sample/logs/log-20220202.txt diff --git a/.gitignore b/.gitignore index 940794e..a85b957 100644 --- a/.gitignore +++ b/.gitignore @@ -286,3 +286,6 @@ __pycache__/ *.btm.cs *.odx.cs *.xsd.cs + +samples/Sample/logs/ + diff --git a/samples/Sample/logs/log-20210214.txt b/samples/Sample/logs/log-20210214.txt deleted file mode 100644 index 0cc28d9..0000000 --- a/samples/Sample/logs/log-20210214.txt +++ /dev/null @@ -1,56 +0,0 @@ -2021-02-14 16:53:57.353 +10:00 [INF] Now listening on: https://localhost:5001 -2021-02-14 16:53:57.378 +10:00 [INF] Now listening on: http://localhost:5000 -2021-02-14 16:53:57.380 +10:00 [INF] Application started. Press Ctrl+C to shut down. -2021-02-14 16:53:57.381 +10:00 [INF] Hosting environment: Development -2021-02-14 16:53:57.382 +10:00 [INF] Content root path: C:\Development\nblumhardt\serilog-aspnetcore\samples\Sample -2021-02-14 16:54:09.107 +10:00 [INF] Hello, world! -2021-02-14 16:54:09.207 +10:00 [INF] HTTP GET / responded 200 in 140.1571 ms -2021-02-14 16:54:11.340 +10:00 [INF] Hello, world! -2021-02-14 16:54:11.344 +10:00 [INF] HTTP GET / responded 200 in 3.9973 ms -2021-02-14 16:54:12.625 +10:00 [ERR] HTTP GET /Home/Privacy responded 500 in 3.3769 ms -System.InvalidOperationException: Something went wrong. - at Sample.Controllers.HomeController.Privacy() in C:\Development\nblumhardt\serilog-aspnetcore\samples\Sample\Controllers\HomeController.cs:line 38 - at lambda_method17(Closure , Object , Object[] ) - at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync() - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() ---- End of stack trace from previous location --- - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() ---- End of stack trace from previous location --- - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() ---- End of stack trace from previous location --- - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) - at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) - at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) - at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext) in C:\Development\nblumhardt\serilog-aspnetcore\src\Serilog.AspNetCore\AspNetCore\RequestLoggingMiddleware.cs:line 60 -2021-02-14 16:54:12.667 +10:00 [ERR] An unhandled exception has occurred while executing the request. -System.InvalidOperationException: Something went wrong. - at Sample.Controllers.HomeController.Privacy() in C:\Development\nblumhardt\serilog-aspnetcore\samples\Sample\Controllers\HomeController.cs:line 38 - at lambda_method17(Closure , Object , Object[] ) - at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync() - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() ---- End of stack trace from previous location --- - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() ---- End of stack trace from previous location --- - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() ---- End of stack trace from previous location --- - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) - at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) - at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) - at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext) in C:\Development\nblumhardt\serilog-aspnetcore\src\Serilog.AspNetCore\AspNetCore\RequestLoggingMiddleware.cs:line 60 - at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context) -2021-02-14 16:54:29.864 +10:00 [INF] Application is shutting down... -2021-02-14 16:54:29.877 +10:00 [INF] Stopped cleanly diff --git a/samples/Sample/logs/log-20220202.txt b/samples/Sample/logs/log-20220202.txt deleted file mode 100644 index a209c7d..0000000 --- a/samples/Sample/logs/log-20220202.txt +++ /dev/null @@ -1,56 +0,0 @@ -2022-02-02 12:58:38.404 +10:00 [INF] Now listening on: https://localhost:5001 -2022-02-02 12:58:38.429 +10:00 [INF] Now listening on: http://localhost:5000 -2022-02-02 12:58:38.430 +10:00 [INF] Application started. Press Ctrl+C to shut down. -2022-02-02 12:58:38.430 +10:00 [INF] Hosting environment: Development -2022-02-02 12:58:38.431 +10:00 [INF] Content root path: C:\Development\nblumhardt\serilog-aspnetcore\samples\Sample -2022-02-02 12:58:45.038 +10:00 [INF] Hello, world! -2022-02-02 12:58:45.132 +10:00 [INF] HTTP GET / responded 200 in 134.6222 ms -2022-02-02 12:58:47.028 +10:00 [INF] Hello, world! -2022-02-02 12:58:47.031 +10:00 [INF] HTTP GET / responded 200 in 3.5411 ms -2022-02-02 12:58:48.217 +10:00 [ERR] HTTP GET /Home/Privacy responded 500 in 3.4740 ms -System.InvalidOperationException: Something went wrong. - at Sample.Controllers.HomeController.Privacy() in C:\Development\nblumhardt\serilog-aspnetcore\samples\Sample\Controllers\HomeController.cs:line 38 - at lambda_method17(Closure , Object , Object[] ) - at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync() - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() ---- End of stack trace from previous location --- - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() ---- End of stack trace from previous location --- - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() ---- End of stack trace from previous location --- - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) - at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) - at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) - at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext) in C:\Development\nblumhardt\serilog-aspnetcore\src\Serilog.AspNetCore\AspNetCore\RequestLoggingMiddleware.cs:line 62 -2022-02-02 12:58:48.259 +10:00 [ERR] An unhandled exception has occurred while executing the request. -System.InvalidOperationException: Something went wrong. - at Sample.Controllers.HomeController.Privacy() in C:\Development\nblumhardt\serilog-aspnetcore\samples\Sample\Controllers\HomeController.cs:line 38 - at lambda_method17(Closure , Object , Object[] ) - at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync() - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() ---- End of stack trace from previous location --- - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) - at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() ---- End of stack trace from previous location --- - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() ---- End of stack trace from previous location --- - at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) - at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) - at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) - at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext) in C:\Development\nblumhardt\serilog-aspnetcore\src\Serilog.AspNetCore\AspNetCore\RequestLoggingMiddleware.cs:line 62 - at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context) -2022-02-02 12:58:58.353 +10:00 [INF] Application is shutting down... -2022-02-02 12:58:58.379 +10:00 [INF] Stopped cleanly