From d29a1b64f1619303973074981bd7ed08ce6c1d22 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Mon, 28 Aug 2017 16:23:35 +1000 Subject: [PATCH 1/7] Dev version bump [Skip CI] --- .../Serilog.Extensions.Logging.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj index 8773bb4..5921152 100644 --- a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj +++ b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj @@ -2,7 +2,7 @@ Low-level Serilog provider for Microsoft.Extensions.Logging - 2.0.2 + 2.0.1 Microsoft;Serilog Contributors net45;net46;net461;netstandard1.3;netstandard2.0 true From 85612f64553a48f39f9f8f181496c1b8d906f546 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Tue, 5 Sep 2017 08:43:09 +1000 Subject: [PATCH 2/7] Show .NET Core 1.0/1.1 example in README [Skip CI] Fixes #109. --- README.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e67fe4a..16db17e 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ A Serilog provider for [Microsoft.Extensions.Logging](https://www.nuget.org/pack ### ASP.NET Core 2.0+ Instructions -ASP.NET Core 2.0 applications should prefer [Serilog.AspNetCore](https://github.com/serilog/serilog-aspnetcore) and `UseSerilog()` instead. +**ASP.NET Core 2.0 applications should prefer [Serilog.AspNetCore](https://github.com/serilog/serilog-aspnetcore) and `UseSerilog()` instead.** -### ASP.NET Core 1.0, 1.1, and Default Provider Integration +### ASP.NET Core 1.0, 1.1 and Default Provider Integration The package implements `AddSerilog()` on `ILoggingBuilder` and `ILoggerFactory` to enable the Serilog provider under the default _Microsoft.Extensions.Logging_ implementation. @@ -35,7 +35,7 @@ public class Startup // Other startup code ``` -**Finally**, in your `Startup` class's `Configure()` method, remove the existing logger configuration entries and +**Finally, for .NET Core 2.0+**, in your `Startup` class's `Configure()` method, remove the existing logger configuration entries and call `AddSerilog()` on the provided `loggingBuilder`. ```csharp @@ -48,6 +48,20 @@ call `AddSerilog()` on the provided `loggingBuilder`. } ``` +**For .NET Core 1.0 or 1.1**, in your `Startup` class's `Configure()` method, remove the existing logger configuration entries and call `AddSerilog()` on the provided `loggerFactory`. + +``` + public void Configure(IApplicationBuilder app, + IHostingEnvironment env, + ILoggerFactory loggerfactory, + IApplicationLifetime appLifetime) + { + loggerfactory.AddSerilog(); + + // Ensure any buffered events are sent at shutdown + appLifetime.ApplicationStopped.Register(Log.CloseAndFlush); +``` + That's it! With the level bumped up a little you should see log output like: ``` From d4f33333b8dbad3580221ed8d680f2464d53e011 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Tue, 5 Sep 2017 08:43:48 +1000 Subject: [PATCH 3/7] Formatting tweaks [Skip CI] --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 16db17e..fe2934f 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ A Serilog provider for [Microsoft.Extensions.Logging](https://www.nuget.org/pack ### ASP.NET Core 2.0+ Instructions -**ASP.NET Core 2.0 applications should prefer [Serilog.AspNetCore](https://github.com/serilog/serilog-aspnetcore) and `UseSerilog()` instead.** +**ASP.NET Core 2.0** applications should prefer [Serilog.AspNetCore](https://github.com/serilog/serilog-aspnetcore) and `UseSerilog()` instead. -### ASP.NET Core 1.0, 1.1 and Default Provider Integration +### .NET Core 1.0, 1.1 and Default Provider Integration The package implements `AddSerilog()` on `ILoggingBuilder` and `ILoggerFactory` to enable the Serilog provider under the default _Microsoft.Extensions.Logging_ implementation. From ae4991fb270760c472ec1e837186cdeddce2939d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9F=D0=B8=D0=B4?= =?UTF-8?q?=D0=B6=D0=B0=D0=BA=D0=BE=D0=B2?= Date: Wed, 17 Jan 2018 15:04:18 +0500 Subject: [PATCH 4/7] I have changed the registration of the LoggerProvider with using a factory for creating an instance. It was necessary because the DI container ignores a registered singleton with an instance during disposing. --- .../SerilogLoggingBuilderExtensions.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Serilog.Extensions.Logging/SerilogLoggingBuilderExtensions.cs b/src/Serilog.Extensions.Logging/SerilogLoggingBuilderExtensions.cs index 701fa4c..d7a3f5f 100644 --- a/src/Serilog.Extensions.Logging/SerilogLoggingBuilderExtensions.cs +++ b/src/Serilog.Extensions.Logging/SerilogLoggingBuilderExtensions.cs @@ -15,6 +15,7 @@ #if LOGGING_BUILDER using System; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Serilog.Extensions.Logging; @@ -38,7 +39,15 @@ public static ILoggingBuilder AddSerilog(this ILoggingBuilder builder, ILogger l { if (builder == null) throw new ArgumentNullException(nameof(builder)); - builder.AddProvider(new SerilogLoggerProvider(logger, dispose)); + if (dispose) + { + builder.Services.AddSingleton(services => new SerilogLoggerProvider(logger, true)); + } + else + { + builder.AddProvider(new SerilogLoggerProvider(logger)); + } + builder.AddFilter(null, LogLevel.Trace); return builder; From b7c975d986984f8bf8e74cd295681bcc171ebb5a Mon Sep 17 00:00:00 2001 From: Matthew Erbs Date: Wed, 9 May 2018 15:56:44 +1000 Subject: [PATCH 5/7] New NuGet API Key --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 2a0d6a6..0f0fb46 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,7 +16,7 @@ artifacts: deploy: - provider: NuGet api_key: - secure: nvZ/z+pMS91b3kG4DgfES5AcmwwGoBYQxr9kp4XiJHj25SAlgdIxFx++1N0lFH2x + secure: bd9z4P73oltOXudAjPehwp9iDKsPtC+HbgshOrSgoyQKr5xVK+bxJQngrDJkHdY8 skip_symbols: true on: branch: /^(master|dev)$/ From 8eb0c77270013779c34018030fb1c3f26e2d4f75 Mon Sep 17 00:00:00 2001 From: Maxime Rouiller Date: Fri, 21 Sep 2018 14:36:21 -0400 Subject: [PATCH 6/7] fixing repository url --- .../Serilog.Extensions.Logging.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj index 5921152..d0adcc8 100644 --- a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj +++ b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj @@ -16,6 +16,8 @@ http://serilog.net/images/serilog-extension-nuget.png https://github.com/serilog/serilog-extensions-logging http://www.apache.org/licenses/LICENSE-2.0 + https://github.com/serilog/serilog-extensions-logging + git false Serilog From 5a8be588051396c17c17b56f802a5d20a428effe Mon Sep 17 00:00:00 2001 From: simenhagelid <42713576+simenhagelid@users.noreply.github.com> Date: Tue, 23 Apr 2019 03:42:54 +0200 Subject: [PATCH 7/7] Use a version wildcard for MEL dependency (#133) --- .../Serilog.Extensions.Logging.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj index d0adcc8..c2b5ba0 100644 --- a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj +++ b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj @@ -2,7 +2,7 @@ Low-level Serilog provider for Microsoft.Extensions.Logging - 2.0.1 + 2.0.3 Microsoft;Serilog Contributors net45;net46;net461;netstandard1.3;netstandard2.0 true @@ -31,7 +31,7 @@ - +