Several appenders for .NET developers to use that send logs straight to SumoLogic.
C# XSLT Smalltalk PowerShell
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
SumoLogic.Logging.Common.Tests Wire through client name values for all appenders Nov 10, 2017
SumoLogic.Logging.Log4Net Add nuget metadata to project files Feb 26, 2018
SumoLogic.Logging.NLog.Example requires layout Nov 15, 2017
TestsResults Initial commit Jul 22, 2015
LICENSE Initial commit Jul 22, 2015
SumoLogic.Logging.sln requires layout Nov 15, 2017

Sumo Logic .NET Appenders

Appenders for .NET logging frameworks which send data to Sumo Logic HTTP sources.

TLS Deprecation Notice
In keeping with industry standard security best practices, as of May 31, 2018, the Sumo Logic service will only support TLS version 1.2 going forward. Verify that all connections to Sumo Logic endpoints are made from software that supports TLS 1.2.


  • .NET 4.5 or later or .NET Standard 1.5
  • A Sumo Logic Account (trial can be started here)


Appenders are provided for the following .NET logging frameworks

  • NLog
  • Log4Net

Both appenders have two implementations: a buffering and a non-buffering version. The non-buffering implementations will send each log message to Sumo Logic in a distinct HTTP request. The buffering implementations will queue messages until a size, count, or time threshold is met, then send in batch.

Nuget Installation


To install the NLog appender, use the following steps

PM> Install-Package SumoLogic.Logging.NLog

Example Appender Configuration

<?xml version="1.0" encoding="utf-8" ?>
<nlog autoReload="true" internalLogToConsole="true">
    <add assembly="SumoLogic.Logging.NLog"/>
    <target name="sumoLogic" type="SumoLogicTarget"	layout="${date:format=yyyy-MM-dd HH\:mm\:ss.fff} ${level}, ${message}">
    <target name="bufferedSumoLogic" type="BufferedSumoLogicTarget" layout="${date:format=yyyy-MM-dd HH\:mm\:ss.fff} ${level}, ${message}">
    <logger name="*" minLevel="Debug" writeTo="sumoLogic"/>
    <logger name="*" minLevel="Debug" writeTo="bufferedSumoLogic"/>

Example Code

public static class Program
    /// <summary>
    /// An example application that logs.
    /// </summary>
    public static void Main()
        Logger logger = LogManager.GetCurrentClassLogger();
        logger.Debug("Log message");

Internal Logging

The Sumo Logic NLog appender can log internal status information and error messages for diagnostic purposes if needed. The simplest way to enable this is to set UseConsoleLog = true through the configuration XML. Internal logging will then be printed to the console.

If an alternative internal logging method is required, you can optionally specify a custom logger. Implement the interface SumoLogic.Logging.Common.Log.ILog and reconfigure targets at runtime per below:

static void ReconfigureSumoTargets()
    foreach (var target in LogManager.Configuration.AllTargets)
        if (!(target is SumoLogicTarget))

        var originalTarget = target as SumoLogicTarget;

        var customTargetLogger = new ILogImpl();  // custom implementation of ILog goes here

        var newTarget = new SumoLogicTarget(customTargetLogger, null)
            AppendException = originalTarget.AppendException,
            ConnectionTimeout = originalTarget.ConnectionTimeout,
            Layout = originalTarget.Layout,
            Name = originalTarget.Name,
            SourceName = originalTarget.SourceName,
            SourceCategory = originalTarget.SourceCategory,
            SourceHost = originalTarget.SourceHost,
            Url = originalTarget.Url,
            UseConsoleLog = false

        if (originalTarget.Name != null)
            LogManager.Configuration.AddTarget(newTarget.Name, newTarget);

        foreach (var rule in LogManager.Configuration.LoggingRules)
            if (rule.Targets.Remove(originalTarget))



To install the Log4Net appender, use the following steps:

PM> Install-Package SumoLogic.Logging.Log4Net

Example Appender Configuration

    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
  <log4net debug="true">
    <appender name="SumoLogicAppender" type="SumoLogic.Logging.Log4Net.SumoLogicAppender, SumoLogic.Logging.Log4Net">
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger - %message%newline"/>
      <Url value="" />
      <ConnectionTimeout value="30000" /> <!-- in milliseconds -->
      <SourceName value="ExampleNameLog4NetAppender" />
      <SourceCategory value="ExampleCategoryLog4NetAppender" />
      <SourceHost value="ExampleHostLog4NetAppender" />
      <UseConsoleLog value="true" />
    <appender name="BufferedSumoLogicAppender" type="SumoLogic.Logging.Log4Net.BufferedSumoLogicAppender, SumoLogic.Logging.Log4Net">
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger - %message%newline"/>
      <Url value="" />
      <SourceName value="ExampleNameLog4NetBufferedAppender" />
      <SourceCategory value="ExampleCategoryLog4NetBufferedAppender" />
      <SourceHost value="ExampleHostLog4NetBufferedAppender" />
      <ConnectionTimeout value="30000" />
      <RetryInterval value="5000" />
      <MessagesPerRequest value="10" />
      <MaxFlushInterval value="10000" />
      <FlushingAccuracy value="250" />
      <MaxQueueSizeBytes value="500000" />
      <UseConsoleLog value="true" />
      <priority value="ALL"/>
      <level value="ALL"/>
      <appender-ref ref="SumoLogicAppender"/>
      <appender-ref ref="BufferedSumoLogicAppender"/>
    <logger name="SumoLogic.Logging.Log4Net.Example.Program">
      <level value="ALL"/>

    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>

Example Code

public static class Program
    /// <summary>
    /// The log4net log.
    /// </summary>
    private static ILog log4netLog = LogManager.GetLogger(typeof(Program));

    /// <summary>
    /// An example application that logs.
    /// </summary>
    public static void Main()
        Console.WriteLine("Hello world!");
        log4netLog.Info("Hello world!");


Apache 2.0