travisrussi / log4net.Rollbar

log4net appender that reports to Rollbar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

log4net.Rollbar

RollbarAppender is a custom log4net appender for reporting events to Rollbar. This package depends on the RollbarSharp package.

https://rollbar.com

Install

Install-Package log4net.Rollbar

Configuration

config file

You must add the appender to your log4net section in app or web.config

Example

<log4net>
  <appender name="RollbarAppender" type="log4net.RollbarAppender, log4net.Rollbar">
    <param name="AccessToken" value="..." />
  </appender>
  <root>
      <level value="ERROR" />
      <appender-ref ref="RollbarAppender" />
    </root>
</log4net>

The AccessToken is the post_server_item key. If not specified as a parameter you must add it to the <appSettings> with <add key="Rollbar.AccessToken" value="..."/>

Code

Or you can use the RollbarAppenderConfigurator when your application initializes.

Example

class Program
{
  static void Main(string[] args)
  {
    RollbarAppenderConfigurator.Configure("<accessToken>");
  }
}

About

log4net appender that reports to Rollbar

License:MIT License


Languages

Language:C# 98.4%Language:Batchfile 1.6%