PH.Log4NetExtensions 0.0.2

Install-Package PH.Log4NetExtensions -Version 0.0.2
dotnet add package PH.Log4NetExtensions --version 0.0.2
<PackageReference Include="PH.Log4NetExtensions" Version="0.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PH.Log4NetExtensions --version 0.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PH.Log4NetExtensions, 0.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install PH.Log4NetExtensions as a Cake Addin
#addin nuget:?package=PH.Log4NetExtensions&version=0.0.2

// Install PH.Log4NetExtensions as a Cake Tool
#tool nuget:?package=PH.Log4NetExtensions&version=0.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

PH.Log4NetExtensions NuGet Badge

Extensions for log4net

Trace

Enable Trace method in ILog.


//simply trace
log.Trace("a message");

//trace with exception
log.Trace("a message with exception", new Exception("some exception"));

NDC Disposable Scope

Push a scope in log4net NDC


//write debug message with no NDC property
log.Debug("with no scope");

using (LogScope.Init("testing my scope"))
{
    //write a trace with NDC property set to "testing my scope"
    log.Trace("a message with scope");
}
log.Debug("with no scope2");

Push a TRACE scope in log4net NDC


//write debug message with no NDC property
log.Debug("with no scope");

using (log.InitTraceLogScope("TRScope"))
{
    //write a trace with NDC property set to "TRScope" and a message set to "----> TRScope"

    //do code...

    //write a trace with NDC property set to "TRScope"
    log.Trace("a message with scope");

    //on disposing write a trace with NDC property set to "TRScope" and a message set to "<---- TRScope"
}

log.Debug("with no scope2");

  • .NETStandard 2.0

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
0.0.2 126 9/30/2020
0.0.1 160 9/15/2020

Fix info in nuget package, add TraceLogScope