In order to quickly understand and fix some errors, it is often helpful to send additional diagnostic data which is specific to that error.
You can set the severity of an error in BugSnag by including the severity option when notifying BugSnag of the error:
import com.bugsnag.Severity;
bugsnag.notify(new RuntimeException("Non-fatal"), Severity.ERROR)
Valid severities are ERROR
, WARNING
and INFO
.
Severity is displayed in the dashboard and can be used to filter the error list.
By default all crashes (or unhandled exceptions) are set to ERROR
and all
bugsnag.notify
calls default to WARNING
.
You can send additional metadata of an error by including a callback when notifying BugSnag of the error:
bugsnag.notify(exception, (report) -> {
report.addToTab("system resources", "memory", "10MB");
});
Or without using the Java 8 lambda syntax:
bugsnag.notify(exception, new Callback() {
@Override
public void beforeNotify(Report report) {
report.addToTab("system resources", "memory", "10MB");
}
});
For all the available options when modifying a report see customizing error reports.
If you are using logback you can configure a BugSnag log appender to automatically report logged exceptions. See configuring logback.