From 61f3c9b03c20a6f02233795a34fb589ac0ee4716 Mon Sep 17 00:00:00 2001 From: Catalin Gavan Date: Mon, 2 May 2022 17:43:43 +0300 Subject: [PATCH] Fix/60 (#61) * Fixes #60 * updated to dotnet 4.6.2 * created KissLog 5.1.2 NuGet --- .../KissLog.Adapters.NLog.csproj | 8 ++--- .../KissLog.Adapters.log4net.csproj | 8 ++--- .../KissLog.AspNet.Mvc.csproj | 3 +- .../KissLog.AspNet.Mvc.nuspec | 8 ++--- .../Properties/AssemblyInfo.cs | 4 +-- .../KissLog.AspNet.Web.csproj | 3 +- .../KissLog.AspNet.Web.nuspec | 10 +++--- .../Properties/AssemblyInfo.cs | 4 +-- .../KissLog.AspNet.WebApi.csproj | 3 +- .../KissLog.AspNet.WebApi.nuspec | 8 ++--- .../Properties/AssemblyInfo.cs | 4 +-- .../KissLog.AspNetCore.csproj | 6 ++-- .../KissLog.CloudListeners.csproj | 10 +++--- .../KissLog.RestClient.csproj | 8 ++--- src/KissLog/Formatters/ExceptionFormatter.cs | 4 ++- src/KissLog/KissLog.csproj | 8 ++--- .../KissLog.AspNet.Mvc.Tests.csproj | 4 +-- .../HttpRequestFactoryTests.cs | 2 ++ .../KissLog.AspNet.Web.Tests.csproj | 3 +- tests/KissLog.AspNet.Web.Tests/app.config | 8 ++--- .../KissLog.AspNet.WebApi.Tests.csproj | 3 +- .../Formatters/ExceptionFormatterTests.cs | 36 +++++++++++++++++++ 22 files changed, 100 insertions(+), 55 deletions(-) diff --git a/adapters/KissLog.Adapters.NLog/KissLog.Adapters.NLog.csproj b/adapters/KissLog.Adapters.NLog/KissLog.Adapters.NLog.csproj index 8919610..0353c69 100644 --- a/adapters/KissLog.Adapters.NLog/KissLog.Adapters.NLog.csproj +++ b/adapters/KissLog.Adapters.NLog/KissLog.Adapters.NLog.csproj @@ -1,10 +1,10 @@ - netstandard2.1;netstandard2.0;net461 + netstandard2.1;netstandard2.0;net462 KissLog.net KissLog.net - 5.1.1 + 5.1.2 Adapter for saving NLog messages to KissLog.net cloud / on-premises. Apache-2.0 https://kisslog.net @@ -12,8 +12,8 @@ https://github.com/KissLog-net/KissLog.Sdk git NLog, KissLog - Adapted to KissLog 5.1.1 improvements. -https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-1 + Adapted to KissLog 5.1.2 improvements. +https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-2 diff --git a/adapters/KissLog.Adapters.log4net/KissLog.Adapters.log4net.csproj b/adapters/KissLog.Adapters.log4net/KissLog.Adapters.log4net.csproj index ce25745..f0c7c56 100644 --- a/adapters/KissLog.Adapters.log4net/KissLog.Adapters.log4net.csproj +++ b/adapters/KissLog.Adapters.log4net/KissLog.Adapters.log4net.csproj @@ -1,10 +1,10 @@  - netstandard2.1;netstandard2.0;net461 + netstandard2.1;netstandard2.0;net462 KissLog.net KissLog.net - 5.1.1 + 5.1.2 Adapter for saving log4Net messages to KissLog.net cloud / on-premises. Apache-2.0 https://kisslog.net @@ -12,8 +12,8 @@ https://github.com/KissLog-net/KissLog.Sdk git log4net, KissLog - Adapted to KissLog 5.1.1 improvements. -https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-1 + Adapted to KissLog 5.1.2 improvements. +https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-2 diff --git a/src/KissLog.AspNet.Mvc/KissLog.AspNet.Mvc.csproj b/src/KissLog.AspNet.Mvc/KissLog.AspNet.Mvc.csproj index 5f6d39e..935b8ca 100644 --- a/src/KissLog.AspNet.Mvc/KissLog.AspNet.Mvc.csproj +++ b/src/KissLog.AspNet.Mvc/KissLog.AspNet.Mvc.csproj @@ -9,9 +9,10 @@ Properties KissLog.AspNet.Mvc KissLog.AspNet.Mvc - v4.6.1 + v4.6.2 512 true + true diff --git a/src/KissLog.AspNet.Mvc/KissLog.AspNet.Mvc.nuspec b/src/KissLog.AspNet.Mvc/KissLog.AspNet.Mvc.nuspec index 474e63e..e83a554 100644 --- a/src/KissLog.AspNet.Mvc/KissLog.AspNet.Mvc.nuspec +++ b/src/KissLog.AspNet.Mvc/KissLog.AspNet.Mvc.nuspec @@ -2,7 +2,7 @@ KissLog.AspNet.Mvc - 5.1.1 + 5.1.2 KissLog.net KissLog.net false @@ -13,14 +13,14 @@ PackageIcon.png KissLog ASP.NET MVC package. Install this package on ASP.NET MVC web applications. - Fixes https://github.com/KissLog-net/KissLog.Sdk/issues/56 - https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-1 + Fixes https://github.com/KissLog-net/KissLog.Sdk/issues/60 + https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-2 Copyright 2021 KissLog, MVC, AspNet - + diff --git a/src/KissLog.AspNet.Mvc/Properties/AssemblyInfo.cs b/src/KissLog.AspNet.Mvc/Properties/AssemblyInfo.cs index 15ae429..76981e7 100644 --- a/src/KissLog.AspNet.Mvc/Properties/AssemblyInfo.cs +++ b/src/KissLog.AspNet.Mvc/Properties/AssemblyInfo.cs @@ -33,5 +33,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("5.1.1.0")] -[assembly: AssemblyFileVersion("5.1.1.0")] +[assembly: AssemblyVersion("5.1.2.0")] +[assembly: AssemblyFileVersion("5.1.2.0")] diff --git a/src/KissLog.AspNet.Web/KissLog.AspNet.Web.csproj b/src/KissLog.AspNet.Web/KissLog.AspNet.Web.csproj index 929f7d6..bbe806f 100644 --- a/src/KissLog.AspNet.Web/KissLog.AspNet.Web.csproj +++ b/src/KissLog.AspNet.Web/KissLog.AspNet.Web.csproj @@ -9,9 +9,10 @@ Properties KissLog.AspNet.Web KissLog.AspNet.Web - v4.6.1 + v4.6.2 512 true + true diff --git a/src/KissLog.AspNet.Web/KissLog.AspNet.Web.nuspec b/src/KissLog.AspNet.Web/KissLog.AspNet.Web.nuspec index 22a6f34..ada281a 100644 --- a/src/KissLog.AspNet.Web/KissLog.AspNet.Web.nuspec +++ b/src/KissLog.AspNet.Web/KissLog.AspNet.Web.nuspec @@ -2,7 +2,7 @@ KissLog.AspNet.Web - 5.1.1 + 5.1.2 KissLog.net KissLog.net false @@ -13,15 +13,15 @@ PackageIcon.png KissLog Web package. You should not manually install this package, as it will be installed as a dependency. - Adapted to KissLog 5.1.1 improvements. - https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-1 + Adapted to KissLog 5.1.2 improvements. + https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-2 Copyright 2021 KissLog - - + + diff --git a/src/KissLog.AspNet.Web/Properties/AssemblyInfo.cs b/src/KissLog.AspNet.Web/Properties/AssemblyInfo.cs index cdd8310..621ac06 100644 --- a/src/KissLog.AspNet.Web/Properties/AssemblyInfo.cs +++ b/src/KissLog.AspNet.Web/Properties/AssemblyInfo.cs @@ -37,5 +37,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("5.1.1.0")] -[assembly: AssemblyFileVersion("5.1.1.0")] +[assembly: AssemblyVersion("5.1.2.0")] +[assembly: AssemblyFileVersion("5.1.2.0")] diff --git a/src/KissLog.AspNet.WebApi/KissLog.AspNet.WebApi.csproj b/src/KissLog.AspNet.WebApi/KissLog.AspNet.WebApi.csproj index c5c5c84..fd357e5 100644 --- a/src/KissLog.AspNet.WebApi/KissLog.AspNet.WebApi.csproj +++ b/src/KissLog.AspNet.WebApi/KissLog.AspNet.WebApi.csproj @@ -9,9 +9,10 @@ Properties KissLog.AspNet.WebApi KissLog.AspNet.WebApi - v4.6.1 + v4.6.2 512 true + true diff --git a/src/KissLog.AspNet.WebApi/KissLog.AspNet.WebApi.nuspec b/src/KissLog.AspNet.WebApi/KissLog.AspNet.WebApi.nuspec index 81e2fb9..70ef429 100644 --- a/src/KissLog.AspNet.WebApi/KissLog.AspNet.WebApi.nuspec +++ b/src/KissLog.AspNet.WebApi/KissLog.AspNet.WebApi.nuspec @@ -2,7 +2,7 @@ KissLog.AspNet.WebApi - 5.1.1 + 5.1.2 KissLog.net KissLog.net false @@ -13,14 +13,14 @@ PackageIcon.png KissLog ASP.NET WebApi package. Install this package on ASP.NET WebApi applications. - Fixes https://github.com/KissLog-net/KissLog.Sdk/issues/56 - https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-1 + Fixes https://github.com/KissLog-net/KissLog.Sdk/issues/60 + https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-2 Copyright 2021 KissLog, WebApi, AspNet - + diff --git a/src/KissLog.AspNet.WebApi/Properties/AssemblyInfo.cs b/src/KissLog.AspNet.WebApi/Properties/AssemblyInfo.cs index bb81f0c..2d21c11 100644 --- a/src/KissLog.AspNet.WebApi/Properties/AssemblyInfo.cs +++ b/src/KissLog.AspNet.WebApi/Properties/AssemblyInfo.cs @@ -33,5 +33,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("5.1.1.0")] -[assembly: AssemblyFileVersion("5.1.1.0")] +[assembly: AssemblyVersion("5.1.2.0")] +[assembly: AssemblyFileVersion("5.1.2.0")] diff --git a/src/KissLog.AspNetCore/KissLog.AspNetCore.csproj b/src/KissLog.AspNetCore/KissLog.AspNetCore.csproj index c47cc82..f34a1e9 100644 --- a/src/KissLog.AspNetCore/KissLog.AspNetCore.csproj +++ b/src/KissLog.AspNetCore/KissLog.AspNetCore.csproj @@ -2,7 +2,7 @@ netstandard2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1;net5.0 - 5.1.1 + 5.1.2 KissLog.net KissLog.net KissLog.net @@ -14,8 +14,8 @@ Install this package on ASP.NET Core web applications. https://github.com/KissLog-net/KissLog.Sdk git KissLog, AspNetCore, NetCore, Core - Fixes https://github.com/KissLog-net/KissLog.Sdk/issues/56 -https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-1 + Fixes https://github.com/KissLog-net/KissLog.Sdk/issues/60 +https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-2 diff --git a/src/KissLog.CloudListeners/KissLog.CloudListeners.csproj b/src/KissLog.CloudListeners/KissLog.CloudListeners.csproj index 8cdbac0..7da975b 100644 --- a/src/KissLog.CloudListeners/KissLog.CloudListeners.csproj +++ b/src/KissLog.CloudListeners/KissLog.CloudListeners.csproj @@ -1,9 +1,9 @@ - + - netstandard2.1;netstandard2.0;net461 + netstandard2.1;netstandard2.0;net462 KissLog.CloudListeners - 5.1.1 + 5.1.2 KissLog.net KissLog.net KissLog.net @@ -14,8 +14,8 @@ https://github.com/KissLog-net/KissLog.Sdk git KissLog - Adapted to KissLog 5.1.1 improvements. -https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-1 + Adapted to KissLog 5.1.2 improvements. +https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-2 diff --git a/src/KissLog.RestClient/KissLog.RestClient.csproj b/src/KissLog.RestClient/KissLog.RestClient.csproj index 059c428..ef39b6e 100644 --- a/src/KissLog.RestClient/KissLog.RestClient.csproj +++ b/src/KissLog.RestClient/KissLog.RestClient.csproj @@ -1,8 +1,8 @@  - netstandard2.1;netstandard2.0;net461 - 5.1.1 + netstandard2.1;netstandard2.0;net462 + 5.1.2 KissLog.net KissLog.net KissLog.net @@ -13,8 +13,8 @@ https://github.com/KissLog-net/KissLog.Sdk git KissLog - Adapted to KissLog 5.1.1 improvements. -https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-1 + Adapted to KissLog 5.1.2 improvements. +https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-2 diff --git a/src/KissLog/Formatters/ExceptionFormatter.cs b/src/KissLog/Formatters/ExceptionFormatter.cs index 886e8f9..d065ae0 100644 --- a/src/KissLog/Formatters/ExceptionFormatter.cs +++ b/src/KissLog/Formatters/ExceptionFormatter.cs @@ -51,7 +51,9 @@ private void FormatException(Exception ex, StringBuilder sb, Logger logger, stri Exception innerException = ex.InnerException; while (innerException != null) { - innerException.Data.Add(id, true); + if (!innerException.Data.Contains(id)) + innerException.Data.Add(id, true); + innerException = innerException.InnerException; } diff --git a/src/KissLog/KissLog.csproj b/src/KissLog/KissLog.csproj index 6c86e29..6464237 100644 --- a/src/KissLog/KissLog.csproj +++ b/src/KissLog/KissLog.csproj @@ -1,7 +1,7 @@  - netstandard2.1;netstandard2.0;net461 + netstandard2.1;netstandard2.0;net462 KissLog.net KissLog.net KissLog.net @@ -13,9 +13,9 @@ Install this package on all the projects. https://github.com/KissLog-net/KissLog.Sdk git Logging, Error, Exception, Trace, Tracing, KissLog, Diagnostics, Reporing - 5.1.1 - Fixes https://github.com/KissLog-net/KissLog.Sdk/issues/56 -https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-1 + 5.1.2 + Fixes https://github.com/KissLog-net/KissLog.Sdk/issues/60 +https://kisslog.net/Docs/SDK.change-log.index.html#kisslog-5-1-2 diff --git a/tests/KissLog.AspNet.Mvc.Tests/KissLog.AspNet.Mvc.Tests.csproj b/tests/KissLog.AspNet.Mvc.Tests/KissLog.AspNet.Mvc.Tests.csproj index 295c6d9..9f16f73 100644 --- a/tests/KissLog.AspNet.Mvc.Tests/KissLog.AspNet.Mvc.Tests.csproj +++ b/tests/KissLog.AspNet.Mvc.Tests/KissLog.AspNet.Mvc.Tests.csproj @@ -10,7 +10,7 @@ Properties KissLog.AspNet.Mvc.Tests KissLog.AspNet.Mvc.Tests - v4.6.1 + v4.6.2 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15.0 @@ -20,6 +20,7 @@ UnitTest + true @@ -114,5 +115,4 @@ - \ No newline at end of file diff --git a/tests/KissLog.AspNet.Web.Tests/HttpRequestFactoryTests.cs b/tests/KissLog.AspNet.Web.Tests/HttpRequestFactoryTests.cs index f9c086e..99bbc13 100644 --- a/tests/KissLog.AspNet.Web.Tests/HttpRequestFactoryTests.cs +++ b/tests/KissLog.AspNet.Web.Tests/HttpRequestFactoryTests.cs @@ -167,6 +167,8 @@ public void QueryStringIsCopiedFromUnvalidatedRequestValues() [TestMethod] public void FormDataIsCopiedFromUnvalidatedRequestValues() { + KissLog.Tests.Common.CommonTestHelpers.ResetContext(); + var value = KissLog.Tests.Common.CommonTestHelpers.GenerateList(5); var unvalidatedValue = KissLog.Tests.Common.CommonTestHelpers.GenerateList(5); diff --git a/tests/KissLog.AspNet.Web.Tests/KissLog.AspNet.Web.Tests.csproj b/tests/KissLog.AspNet.Web.Tests/KissLog.AspNet.Web.Tests.csproj index 392f7e1..aadb8ff 100644 --- a/tests/KissLog.AspNet.Web.Tests/KissLog.AspNet.Web.Tests.csproj +++ b/tests/KissLog.AspNet.Web.Tests/KissLog.AspNet.Web.Tests.csproj @@ -10,7 +10,7 @@ Properties KissLog.AspNet.Web.Tests KissLog.AspNet.Web.Tests - v4.6.1 + v4.6.2 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15.0 @@ -20,6 +20,7 @@ UnitTest + true diff --git a/tests/KissLog.AspNet.Web.Tests/app.config b/tests/KissLog.AspNet.Web.Tests/app.config index f10b4ac..6a002f0 100644 --- a/tests/KissLog.AspNet.Web.Tests/app.config +++ b/tests/KissLog.AspNet.Web.Tests/app.config @@ -1,11 +1,11 @@ - + - - + + - \ No newline at end of file + diff --git a/tests/KissLog.AspNet.WebApi.Tests/KissLog.AspNet.WebApi.Tests.csproj b/tests/KissLog.AspNet.WebApi.Tests/KissLog.AspNet.WebApi.Tests.csproj index 9e65ad8..bf2650d 100644 --- a/tests/KissLog.AspNet.WebApi.Tests/KissLog.AspNet.WebApi.Tests.csproj +++ b/tests/KissLog.AspNet.WebApi.Tests/KissLog.AspNet.WebApi.Tests.csproj @@ -10,7 +10,7 @@ Properties KissLog.AspNet.WebApi.Tests KissLog.AspNet.WebApi.Tests - v4.6.1 + v4.6.2 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15.0 @@ -20,6 +20,7 @@ UnitTest + true diff --git a/tests/KissLog.Tests/Formatters/ExceptionFormatterTests.cs b/tests/KissLog.Tests/Formatters/ExceptionFormatterTests.cs index e750cbd..29817d6 100644 --- a/tests/KissLog.Tests/Formatters/ExceptionFormatterTests.cs +++ b/tests/KissLog.Tests/Formatters/ExceptionFormatterTests.cs @@ -131,6 +131,42 @@ public void SameExceptionMessageIsLoggedEachTime() Assert.AreEqual(2, count); } + [TestMethod] + public void SameInnerExceptionDoesNotThrowException() + { + var innerEx = new Exception($"Inner exception: {Guid.NewGuid()}"); + + var ex1 = new Exception("Exception 1", innerEx); + var ex2 = new Exception("Exception 2", innerEx); + + Logger logger = new Logger(); + + var formatter = new ExceptionFormatter(); + formatter.Format(ex1, logger); + formatter.Format(ex2, logger); + + int count = logger.DataContainer.Exceptions.Count(); + + Assert.AreEqual(2, count); + } + + [TestMethod] + public void InnerExceptionIsLoggedOnlyOnce() + { + var innerEx = new Exception($"Inner exception: {Guid.NewGuid()}"); + var ex = new Exception("Exception", innerEx); + + Logger logger = new Logger(); + + var formatter = new ExceptionFormatter(); + formatter.Format(ex, logger); + formatter.Format(innerEx, logger); + + int count = logger.DataContainer.Exceptions.Count(); + + Assert.AreEqual(1, count); + } + [TestMethod] public void AppendExceptionDetailsOptions() {