Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Prototype.RollbarTraceListener ref #121: Add an example/demo of a Rollbar.NET plug-in for a popular … May 8, 2018
Rollbar - resolve #180: Redo meaning of the log level config setting into log… Aug 15, 2018
Sample.AspNetCore2.WebApi
Sample.Net.ConsoleApp - resolve #179: Improve RollbarAssistant's CaptureState APIs by allow… Aug 10, 2018
Sample.NetCore.ConsoleApp code/design clean-up/tune-up: Jun 13, 2018
Sample.RollbarWithinStronglyNamedAssembly - resolve #145: Update sample apps to target latest .net SDKs and lat… May 31, 2018
Sample.WebForms.Site - resolve #145: Update sample apps to target latest .net SDKs and lat… May 31, 2018
Sample.Xamarin.Forms - ref #153: Not able to get correct traceback (added example of repor… Jul 13, 2018
UnitTest.Rollbar - resolve #179: Improve RollbarAssistant's CaptureState APIs by allow… Aug 10, 2018
.gitattributes Initial solution setup. Oct 24, 2017
.gitignore resolve #103: Split out every sample app into its own solution. Mar 15, 2018
LICENSE Initial commit May 16, 2016
README.md Update README.md Aug 6, 2018
ReadMe.txt Expanded currently supported .NET platform targets list: Dec 4, 2017
Rollbar.sln - resolve #171: Fix some unit tests failing during the unit tests bat… Jul 11, 2018
Sample.AspNetCore2.WebApi.sln resolve #103: Split out every sample app into its own solution. Mar 15, 2018
Sample.Net.ConsoleApp.sln resolve #103: Split out every sample app into its own solution. Mar 15, 2018
Sample.NetCore.ConsoleApp.sln resolve #103: Split out every sample app into its own solution. Mar 15, 2018
Sample.RollbarWithinStronglyNamedAssembly.sln
Sample.WebForms.Site.sln resolve #103: Split out every sample app into its own solution. Mar 15, 2018
Sample.Xamarin.Forms.sln resolve #103: Split out every sample app into its own solution. Mar 15, 2018
Sequential.runsettings - resolve #171: Fix some unit tests failing during the unit tests bat… Jul 11, 2018
Settings.StyleCop Stylecop settings Jun 22, 2016
SolutionCommon.csproj - resolve #180: Redo meaning of the log level config setting into log… Aug 15, 2018
appveyor.yml resolve #103: Split out every sample app into its own solution. Mar 15, 2018
build-release.bat
rollbar-logo.png added logo for nuget package Jun 8, 2016

README.md

Rollbar.NET

A .NET Rollbar Client that can be used in any application built on the following .NET versions: .NET Core 2.0+, .NET Standard 2.0+, and .NET Full Framework 4.5+.

Install

Nuget Package Manager:

Install-Package Rollbar

Blocking vs Non-Blocking Use

The SDK is designed to have as little impact on the hosting system or application as possible. Normally, you want to use asynchronous logging, since it has virtually no instrumentational overhead on your application execution performance at runtime. It has a "fire and forget" approach to logging.

However, in some specific situations (such as while logging right before exiting an application), you may want to use it synchronously so that the application does not quit before the logging completes.

That is why all the logging methods of the ILogger interface imply asynchronous/non-blocking implementation. However, the ILogger interface defines the AsBlockingLogger(TimeSpan timeout) method that returns a synchronous implementation of the same ILogger. This approach allows for easier code refactoring when switching between asynchronous and synchronous uses of the logger.

Therefore, the following call will perform async logging:

RollbarLocator.RollbarInstance.Log(ErrorLevel.Error, "test message");

While this call will perform blocking/synchronous logging with a timeout of 1 second:

RollbarLocator.RollbarInstance.AsBlockingLogger(TimeSpan.FromSeconds(5)).Log(ErrorLevel.Error, "test message");

In case of a timeout, all the blocking log methods throw System.TimeoutException instead of gracefully completing the call. Therefore you might want to make all the blocking log calls within a try-catch block while catching System.TimeoutException specifically to handle a timeout case.

Basic Usage

  • Configure Rollbar with RollbarLocator.RollbarInstance.Configure(new RollbarConfig("POST_SERVER_ITEM_ACCESS_TOKEN"))
  • Send errors (asynchronously) to Rollbar with RollbarLocator.RollbarInstance.Error(Exception)
  • Send messages (synchronously) to Rollbar with RollbarLocator.RollbarInstance.AsBlockingLogger(TimeSpan.FromSeconds(5)).Info(string)

Upgrading to v1.0.0+ from earlier versions

In order to upgrade to v1.0.0+ from an earlier version, you should change your config from the old version

Rollbar.Init(new RollbarConfig("POST_SERVER_ITEM_ACCESS_TOKEN"));

to

const string postServerItemAccessToken = "POST_SERVER_ITEM_ACCESS_TOKEN";
RollbarLocator.RollbarInstance
.Configure(new RollbarConfig(postServerItemAccessToken) { Environment = "proxyTest" }) ;

Additionally, anywhere in your code that you were sending error reports via Rollbar.Report(Exception) or Rollbar.Report(string) will need to be replaced with either something like RollbarLocator.RollbarInstance.Error(new Exception("trying out the TraceChain", new NullReferenceException())) or RollbarLocator.RollbarInstance.Info("Basic info log example.").

More Information about the SDK

More detailed information about Rollbar.NET usage and API reference are available at https://docs.rollbar.com/docs/dotnet

Help / Support

If you run into any issues, please email us at support@rollbar.com

For bug reports, please open an issue on GitHub.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request