From d65d3b3b9e3ff4f070ee0535b6b238968976b19f Mon Sep 17 00:00:00 2001 From: Costin Zaharia <56015273+costin-zaharia-sonarsource@users.noreply.github.com> Date: Mon, 26 Feb 2024 09:16:40 +0100 Subject: [PATCH] Modify Rule S667: Update title (#3681) --- rules/S6667/metadata.json | 2 +- rules/S6667/why-dotnet.adoc | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/rules/S6667/metadata.json b/rules/S6667/metadata.json index 5dcfdecd7d..5918a20607 100644 --- a/rules/S6667/metadata.json +++ b/rules/S6667/metadata.json @@ -1,5 +1,5 @@ { - "title": "Logging in a catch clause should include the exception", + "title": "Logging in a catch clause should pass the caught exception as a parameter.", "type": "CODE_SMELL", "status": "ready", "remediation": { diff --git a/rules/S6667/why-dotnet.adoc b/rules/S6667/why-dotnet.adoc index 43a047b1df..32c021fe57 100644 --- a/rules/S6667/why-dotnet.adoc +++ b/rules/S6667/why-dotnet.adoc @@ -9,3 +9,11 @@ A log entry should contain all the relevant information about the current execut https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loggerextensions[Logging methods] provide overloads that accept an `Exception` as a parameter and https://learn.microsoft.com/en-us/dotnet/core/extensions/logging-providers[logging providers] persist the `Exception` in a structured way to facilitate the tracking of system failures. Therefore `Exceptions` should be passed to the logger. + +The rule covers the following logging frameworks: + +* Nuget package - https://www.nuget.org/packages/Castle.Core[Castle.Core] +* Nuget package - https://www.nuget.org/packages/Common.Logging.Core[Common.Core] +* Nuget package - https://www.nuget.org/packages/log4net[log4net] +* Nuget package - https://www.nuget.org/packages/NLog[NLog] +* Nuget package - https://www.nuget.org/packages/Microsoft.Extensions.Logging[Microsoft.Extensions.Logging]