Make Your Logs Work for You

The days of logging in to servers and manually viewing log files are over. SolarWinds® Papertrail™ aggregates logs from applications, devices, and platforms to a central location.

View Technology Info


Troubleshoot Fast and Enjoy It

SolarWinds® Papertrail™ provides cloud-based log management that seamlessly aggregates logs from applications, servers, network devices, services, platforms, and much more.

View Capabilities Info


Aggregate and Search Any Log

SolarWinds® Papertrail™ provides lightning-fast search, live tail, flexible system groups, team-wide access, and integration with popular communications platforms like PagerDuty and Slack to help you quickly track down customer problems, debug app requests, or troubleshoot slow database queries.

View Languages Info


TBD - APM Integration Title

TBD - APM Integration Description

TBD Link

APM Integration Feature List

TBD - Built for Collaboration Title

TBD - Built for Collaboration Description

TBD Link

Built for Collaboration Feature List

Collect Logs: Apps & Services > C# and .NET (log4net)

C# and .NET (log4net)


log4net is “a tool to help the programmer output log statements to a variety of output targets. log4net is a port of the excellent Apache log4j™ framework to the Microsoft® .NET runtime.”

Papertrail supports aggregating messages from a native log4net appender, providing a live searchable log console for your .NET app.

If log4net isn’t already in use and a simpler solution is preferable, use SimpleSysLog instead.


Install log4net in your app. At its core, this is importing the classes:

using log4net;
using log4net.Config;

and then initializing log4net by pointing it to a config file path (which we’ll create in the next step):

XmlConfigurator.Configure(new System.IO.FileInfo(args[0]));

In the example above, the path to the config file is in args[0]. Replace that variable with a variable set by your app’s runtime configuration or a path or UNC path as a string (more).

Here’s full log4net docs.

Create log4net config file

Here’s a sample log4net config file with 1 logger (the top-level root logger) sending only to 1 appender. That RemoteSyslogAppender instance sends to Papertrail.

Logs from this app will be identified with the system’s hostname and the app name MyApp, as defined in the config Identity option below. See Tweak Identity and PatternLayout for ways to control this.

In the example below, replace logsN and XXXXX with details from Papertrail’s Add Systems page.

  <appender name="PapertrailRemoteSyslogAppender" type="log4net.Appender.RemoteSyslogAppender">
    <facility value="Local6" />
    <identity value="%date{yyyy-MM-ddTHH:mm:ss.ffffffzzz} %P{log4net:HostName} MyApp" />
    <layout type="log4net.Layout.PatternLayout" value="%level - %message%newline" />
    <remoteAddress value="" />
    <remotePort value="XXXXX" />
  <level value="DEBUG" />
  <appender-ref ref="PapertrailRemoteSyslogAppender" />

Tweak Identity and PatternLayout

In the configuration above, the log message is defined with:

<identity value="%date{yyyy-MM-ddTHH:mm:ss.ffffffzzz} %P{log4net:HostName} MyApp" />
<layout type="log4net.Layout.PatternLayout" value="%level - %message%newline" />

This will generate a message like:

Mar 23 23:59:59 SYSTEM_NAME MyApp: INFO - the message

Both the identity and the format can be customized. The identity could include the name of your app and/or a fixed hostname.

The PatternLayout can include additional values, which are covered in log4net’s PatternLayout documentationfilelogger, and %aspnet-request{key} may be relevant to your application.


Consider using ThreadContext to set arbitrary keys and values, such as a user ID or request ID. For example:

ThreadContext.Properties["user"] = userName;
ThreadContext.Properties["request"] = "abc123";


Papertrail is just another log4net target, so no code changes should be needed for apps which already use log4net.

If you aren’t yet using log4net, generate messages with:

private static readonly ILog log = LogManager.GetLogger(typeof(MyApp));
log.Debug("Did it again!");

See log4net docs.

The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.