Gbase.NLog.JsonTarget 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Gbase.NLog.JsonTarget --version 1.0.0                
NuGet\Install-Package Gbase.NLog.JsonTarget -Version 1.0.0                
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="Gbase.NLog.JsonTarget" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Gbase.NLog.JsonTarget --version 1.0.0                
#r "nuget: Gbase.NLog.JsonTarget, 1.0.0"                
#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.
// Install Gbase.NLog.JsonTarget as a Cake Addin
#addin nuget:?package=Gbase.NLog.JsonTarget&version=1.0.0

// Install Gbase.NLog.JsonTarget as a Cake Tool
#tool nuget:?package=Gbase.NLog.JsonTarget&version=1.0.0                


A NLog target that posts Json to a http endpoint


Currently using ServiceStack.Text for serialization and HttpClient to post asynchronously.


Add Gbase.NLog.JsonTarget to your solution and update your nlog.config:

Add the assembly to the extensions section

       <add assembly="Gbase.NLog.JsonTarget" />

Add the target with a url & fields to post

   <targets async="true">
       <target name="SampleTarget" xsi:type="JsonPost"

         <field name="time" layout="${date:universalTime=True:format=yyyy-MM-ddTHH\:mm\:ss.FFFZ}" />
         <field name="msg" layout="${message}" />
         <field name="src" layout="${logger}" />
         <field name="lvl" layout="${level}" />
         <field name="exception" />
         <field name="properties"/>

*Field* can be a layout or property of the LogEventInfo class. In this example the exception and properties
of the log event will be sent as objects.

Add a rule to send log events to the target

       <logger name="*" minlevel="Debug" writeTo="SampleTarget"/>


   var log = LogManager.GetLogger("myloggername");

   var le = new LogEventInfo();
   le.Level = LogLevel.Info;
   le.Message = "Hello, Json";
   le.Properties["a key"] = "a value";
   le.Properties[5] = 10;



       "time" : "0001-01-01T05:00:00Z",
       "msg" : "Hello, Json",
       "lvl" : "Info",
       "src" : "myloggername",
       "properties" : {
           "a key" : "a value",
           "5" : 10,


Released under MIT License. Enjoy!

Product Compatible and additional computed target framework versions.
.NET Framework net451 is compatible.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 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
1.0.4 1,737 10/27/2015
1.0.3 1,242 9/11/2014
1.0.1 1,125 8/15/2014
1.0.0 1,109 8/14/2014