LoggingHelperPackage-dev 11.5.1

dotnet add package LoggingHelperPackage-dev --version 11.5.1
                    
NuGet\Install-Package LoggingHelperPackage-dev -Version 11.5.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LoggingHelperPackage-dev" Version="11.5.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LoggingHelperPackage-dev" Version="11.5.1" />
                    
Directory.Packages.props
<PackageReference Include="LoggingHelperPackage-dev" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LoggingHelperPackage-dev --version 11.5.1
                    
#r "nuget: LoggingHelperPackage-dev, 11.5.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LoggingHelperPackage-dev@11.5.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LoggingHelperPackage-dev&version=11.5.1
                    
Install as a Cake Addin
#tool nuget:?package=LoggingHelperPackage-dev&version=11.5.1
                    
Install as a Cake Tool

Log Helper Library

  • Logs all the controllers' actions inputs and results

Setup

  1. Ensure Serilog is installed in the application you want to log.
  2. Use the IServiceCollection extension method to register the logging middleware via services.RegisterLogging();.
  3. Configure the logging middleware through your appsettings.json file. The following is an example configuration:
{
    "Applications": {
        "Apps": {
            "LoggingEnabled": true,
            "appName": "<App Name>",
            "collectionName": "<MongoDB Collection Name>",
            "DatabaseName": "<MongoDB DB Name>",
            "DatabaseConnection": "<MongoDB Connection String",
            "Loki": {
                "Enable": true,
                "Url": "<Loki Connection String>",
                "Labels": [
                    {
                        "Key": "app",
                        "Value": "<App Name>"
                    },
                    {
                        "Key": "environment",
                        "Value": "<Environment Name>"
                    },
                    {
                        "Key": "jobs",
                        "Value": "HangFire"
                    }

                ],
                "UserName": <Username>,
                "Password": <Password>
            },
            "MSSQL": {
                "Enable": false,
                "ConnectionString": "<Connection String>",
                "TableName": "<Table Name>"
            },
            "OTLPConfig": {
                "Enabled": true
            }
        }
    },

}

Notes

  • The middleware mainly logs request failure/completion, if you need to log DB queries to Aspire, ensure you've added "Microsoft.EntityFrameworkCore.Database.Command": "Information" to your logging config.
  • MongoDB logging is enabled by default, if you want to disable it, set the LoggingEnabled property to false in your appsettings.json file.

Old Documentation

<h1>Log Helper Library </h1> <p> This library is customized to log all the controllers' actions inputs and results</p> <h3> How to use</h3> <ol> <li>Install Serilog pckage in the application you want to log</li> <li>In program.cs, add the using statement : using LoggingHelperLibrary</li> <li>In program.cs, add the following code <p>var AppLogging = new Application() { AppName = "DigitalPlatformVacation", CollectionName = "DigitalPlatformVacation", DatabaseName = "ApplicationsLogs", DatabaseConnection = "mongodb://eva-mongodb:mZ3aja0u8ozMtwV1LvK9HEMLG0B12vmEcmcG4kmvE5Qjmzjbdtkz1yyoGEZxi5jbvbas2zzo6MQBfEqBDZRLlw==@eva-mongodb.mongo.cosmos.azure.com:10255/?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@eva-mongodb@" }; </br>Log.Logger = BuildLoggerObject.BuildLogger(AppLogging.DatabaseConnection, AppLogging.DatabaseName, AppLogging.CollectionName); </p> </li> <li>In program.cs,replace this line --> builder.Services.AddControllers(); by this--> builder.Services.AddControllers(x ⇒ x.Filters.Add<LogFilterAttribute>()); </li> <li>In program.cs, register the log middlewares before MapControllers Middleware --> RegisterLogsMiddlewares.LogsMiddlewareRegister(app);</li> <li>Add the folloing packages references in .csproj file</br> <PackageReference Include="Newtonsoft.Json" Version="13.0.2" /></br> <PackageReference Include="Serilog.AspNetCore" Version="6.1.0" /></br> <PackageReference Include="Serilog.Exceptions" Version="8.4.0" /></br> <PackageReference Include="Serilog.Extensions.Hosting" Version="5.0.1" /></br> <PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" /></br> <PackageReference Include="Serilog.Sinks.MongoDB" Version="5.3.1" /> <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.26.0" /></br> </li> </ol>

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.5.1 175 10/27/2025