All available options for configuring your integration with BugSnag.
You can configure BugSnag in code or through the Configuration API. Each key provides an in code example and if possible a json config file example. In an ASP.NET Core application you can use the following line to configure BugSnag using the available configuration providers.
services.Configure<Bugsnag.Configuration>(Configuration.GetSection("Bugsnag"));
Your BugSnag API key (required)
configuration.ApiKey = "your-api-key"
{
"Bugsnag": {
"ApiKey": "your-api-key"
}
}
You can find your API key in Project Settings from your BugSnag dashboard.
You can set the type of application executing the current code by using this key.
configuration.AppType = "worker";
{
"Bugsnag": {
"AppType": "worker"
}
}
If you want to track which versions of your application each exception
happens in, you can set AppVersion
.
configuration.AppVersion = "2.5.1";
{
"Bugsnag": {
"AppVersion": "2.5.1"
}
}
Set to true if you would like BugSnag to automatically capture sessions. Using this option in a web framework that we support will report a session each time a request is received.
configuration.AutoCaptureSessions = true;
{
"Bugsnag": {
"AutoCaptureSessions": true
}
}
By default we will automatically notify BugSnag of any fatal exceptions in your application. Use this option if you want to stop this from happening.
configuration.AutoNotify = false;
{
"Bugsnag": {
"AutoNotify": false
}
}
Sets the URL used to send error reports to BugSnag. This defaults to https://notify.bugsnag.com
, but should be overridden if you are using BugSnag On-premise, to point to your own BugSnag endpoint.
configuration.Endpoint = new Uri("https://bugsnag.internal.example.com");
{
"Bugsnag": {
"Endpoint": "https://bugsnag.internal.example.com"
}
}
Metadata that will be attached to all error reports sent by the client.
configuration.GlobalMetadata = new[] { new KeyValuePair<string, object>("account", new System.Collections.Generic.Dictionary<string, string> { { "company", "Acme Co." } }) };
A list of exception types that should be ignored. If a report contains exceptions of these types then the report will not be sent to BugSnag. Checks to see if each exception type is in the inheritance hierarchy of each IgnoreClass
or is an interface that the exception implements.
configuration.IgnoreClasses = new [] { typeof(Bugsnag.NotThatBadException), typeof(System.NotImplementedException) };
This is the maximum number of breadcrumbs that will be sent along with each error report. The maximum payload size is 1MB and breadcrumbs will be stripped if the client is unable to send the report due to a large number of breadcrumbs. The default value for this is 25.
configuration.MaximumBreadcrumbs = 25;
{
"Bugsnag": {
"MaximumBreadcrumbs": 25
}
}
Sets which keys should be filtered out from metadata before sending them to BugSnag. Use this if you want to ensure you don’t send sensitive data such as passwords, and credit card numbers to our servers. Any keys in the metadata of the error report will have their values replaces with [FILTERED]
. By default these are populated with the following values: “password”, “Authorization”.
configuration.MetadataFilters = new [] { "password", "creditcard" };
{
"Bugsnag": {
"MetadataFilters": ["password", "creditcard"]
}
}
By default, we will notify BugSnag of exceptions that happen in any
ReleaseStage
. If you would like to change which release stages notify BugSnag
of exceptions you can set NotifyReleaseStages
:
configuration.NotifyReleaseStages = new [] { "staging", "production" };
{
"Bugsnag": {
"NotifyReleaseStages": ["staging", "production"]
}
}
We mark stacktrace lines as inProject
if they come from namespaces included in your project namespaces.
configuration.ProjectNamespaces = new [] { "App.Code", "Bugsnag.Tests" };
{
"Bugsnag": {
"ProjectNamespaces": ["App.Code", "Bugsnag.Tests"]
}
}
Project roots are used to strip file paths in each error reports stack trace in order to normalize them across builds.
configuration.ProjectRoots = new [] { @"C:\app", @"D:\src" };
{
"Bugsnag": {
"ProjectRoots": ["C:\app", "D:\src"]
}
}
Sets the address of the HTTP proxy that should be used for requests to BugSnag. You can also provide authentication details.
var credential = new System.Net.NetworkCredential(username, password);
var proxyAddress = new Uri("https://hostname:port");
configuration.Proxy = new System.Net.WebProxy(proxyAddress, false, null, credential);
If you would like to distinguish between errors that happen in different stages of the application release process (development, production, etc) you can set the ReleaseStage
that is reported to BugSnag. This will default to production
if not specified.
configuration.ReleaseStage = "development";
{
"Bugsnag": {
"ReleaseStage": "development"
}
}
Set the endpoint to which tracked sessions reports are sent. This defaults to https://sessions.bugsnag.com, but should be overridden if you are using BugSnag On-premise, to point to your own BugSnag endpoint.
configuration.SessionEndpoint = new Uri("https://sessions.example.com");
{
"Bugsnag": {
"SessionEndpoint": "https://sessions.example.com"
}
}