public class Bugsnag
extends java.lang.Object
| Constructor and Description |
|---|
Bugsnag(java.lang.String apiKey)
Initialize a Bugsnag client and automatically send uncaught exceptions.
|
Bugsnag(java.lang.String apiKey,
boolean sendUncaughtExceptions)
Initialize a Bugsnag client.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCallback(Callback callback)
Add a callback to execute code before/after every notification to Bugsnag.
|
Report |
buildReport(java.lang.Throwable throwable)
Build an Report object to send to Bugsnag.
|
void |
close()
Close the connection to Bugsnag and unlink the exception handler.
|
Delivery |
getDelivery()
Get the delivery to use to send reports.
|
boolean |
notify(Report report)
Notify Bugsnag of an exception and provide custom diagnostic data
for this particular error report.
|
boolean |
notify(Report report,
Callback reportCallback)
Notify Bugsnag of an exception and provide custom diagnostic data
for this particular error report.
|
boolean |
notify(java.lang.Throwable throwable)
Notify Bugsnag of a handled exception.
|
boolean |
notify(java.lang.Throwable throwable,
Callback callback)
Notify Bugsnag of a handled exception.
|
boolean |
notify(java.lang.Throwable throwable,
Severity severity)
Notify Bugsnag of a handled exception - with a severity.
|
boolean |
notify(java.lang.Throwable throwable,
Severity severity,
Callback callback)
Notify Bugsnag of a handled exception.
|
void |
setAppType(java.lang.String appType)
Set the application type sent to Bugsnag.
|
void |
setAppVersion(java.lang.String appVersion)
Set the application version sent to Bugsnag.
|
void |
setAutoCaptureSessions(boolean autoCaptureSessions)
Sets whether or not Bugsnag should automatically capture and report User
sessions for each request.
|
void |
setDelivery(Delivery delivery)
Set the method of delivery for Bugsnag error report.
|
void |
setEndpoint(java.lang.String endpoint)
Deprecated.
use
Configuration.setEndpoints(String, String) instead |
void |
setEndpoints(java.lang.String notify,
java.lang.String sessions)
Set the endpoints to send data to.
|
void |
setFilters(java.lang.String... filters)
Set which keys should be filtered when sending metaData to Bugsnag.
|
void |
setIgnoreClasses(java.lang.String... ignoreClasses)
Set which exception classes should be ignored (not sent) by Bugsnag.
|
void |
setNotifyReleaseStages(java.lang.String... notifyReleaseStages)
Set for which releaseStages errors should be sent to Bugsnag.
|
void |
setProjectPackages(java.lang.String... projectPackages)
Set which packages should be considered part of your application.
|
void |
setProxy(java.net.Proxy proxy)
Set a proxy to use when delivering Bugsnag error reports and sessions.
|
void |
setReleaseStage(java.lang.String releaseStage)
Set the current "release stage" of your application.
|
void |
setSendThreads(boolean sendThreads)
Set whether Bugsnag should capture and report thread-state for all
running threads.
|
void |
setSessionDelivery(Delivery delivery)
Set the method of delivery for Bugsnag sessions.
|
void |
setSessionEndpoint(java.lang.String endpoint)
Deprecated.
use
Configuration.setEndpoints(String, String) instead |
void |
setTimeout(int timeout)
Set a timeout (in ms) to use when delivering Bugsnag error reports and sessions.
|
boolean |
shouldAutoCaptureSessions()
Retrieves whether or not Bugsnag should automatically capture
and report User sessions for each request.
|
void |
startSession()
Manually starts tracking a new session.
|
static java.util.Set<Bugsnag> |
uncaughtExceptionClients()
Retrieves all instances of
Bugsnag which are registered to
catch uncaught exceptions. |
public Bugsnag(java.lang.String apiKey)
apiKey - your Bugsnag API key from your Bugsnag dashboardpublic Bugsnag(java.lang.String apiKey,
boolean sendUncaughtExceptions)
apiKey - your Bugsnag API keysendUncaughtExceptions - should we send uncaught exceptions to Bugsnagpublic void addCallback(Callback callback)
You can use this to add or modify information attached to an error before it is sent to your dashboard. You can also stop any reports being sent to Bugsnag completely.
callback - a callback to run before sending errors to BugsnagCallbackpublic Delivery getDelivery()
Deliverypublic void setAppType(java.lang.String appType)
appType - the app type to send, eg. spring, gradleTaskpublic void setAppVersion(java.lang.String appVersion)
appVersion - the app version to sendpublic void setDelivery(Delivery delivery)
delivery - the delivery mechanism to useDeliverypublic void setSessionDelivery(Delivery delivery)
delivery - the delivery mechanism to useDelivery@Deprecated public void setEndpoint(java.lang.String endpoint)
Configuration.setEndpoints(String, String) insteadendpoint - the endpoint to send reports tosetDelivery(com.bugsnag.delivery.Delivery)public void setFilters(java.lang.String... filters)
filters - a list of String keys to filter from metaDatapublic void setIgnoreClasses(java.lang.String... ignoreClasses)
ignoreClasses - a list of exception classes to ignorepublic void setNotifyReleaseStages(java.lang.String... notifyReleaseStages)
notifyReleaseStages - a list of releaseStages to notify forsetReleaseStage(java.lang.String)public void setProjectPackages(java.lang.String... projectPackages)
projectPackages - a list of package namespublic void setProxy(java.net.Proxy proxy)
proxy - the proxy to use to send reportspublic void setReleaseStage(java.lang.String releaseStage)
releaseStage - the release stage of the appsetNotifyReleaseStages(java.lang.String...)public void setSendThreads(boolean sendThreads)
sendThreads - should we send thread state with error reportssetNotifyReleaseStages(java.lang.String...)public void setTimeout(int timeout)
timeout - the timeout to set (in ms)setDelivery(com.bugsnag.delivery.Delivery)public Report buildReport(java.lang.Throwable throwable)
throwable - the exception to send to BugsnagReport,
notify(com.bugsnag.Report)public boolean notify(java.lang.Throwable throwable)
throwable - the exception to send to Bugsnagpublic boolean notify(java.lang.Throwable throwable,
Callback callback)
throwable - the exception to send to Bugsnagcallback - the Callback object to run for this Reportpublic boolean notify(java.lang.Throwable throwable,
Severity severity)
throwable - the exception to send to Bugsnagseverity - the severity of the error, one of {#link Severity#ERROR},
Severity.WARNING or Severity.INFOpublic boolean notify(java.lang.Throwable throwable,
Severity severity,
Callback callback)
throwable - the exception to send to Bugsnagseverity - the severity of the error, one of {#link Severity#ERROR},
Severity.WARNING or Severity.INFOcallback - the Callback object to run for this Reportpublic boolean notify(Report report)
report - the Report object to send to BugsnagReport,
buildReport(java.lang.Throwable)public boolean notify(Report report, Callback reportCallback)
report - the Report object to send to BugsnagreportCallback - the Callback object to run for this ReportReport,
buildReport(java.lang.Throwable)public void startSession()
setAutoCaptureSessions(boolean), which will automatically create a new
session for each requestpublic void setAutoCaptureSessions(boolean autoCaptureSessions)
By default this behavior is disabled.
autoCaptureSessions - whether sessions should be captured automaticallypublic boolean shouldAutoCaptureSessions()
@Deprecated public void setSessionEndpoint(java.lang.String endpoint)
Configuration.setEndpoints(String, String) insteadendpoint - the endpoint to send reports tosetDelivery(com.bugsnag.delivery.Delivery)public void setEndpoints(java.lang.String notify,
java.lang.String sessions)
throws java.lang.IllegalArgumentException
Delivery, this method should be called after
the custom implementation has been set.notify - the notify endpointsessions - the sessions endpointjava.lang.IllegalArgumentException - if the notify endpoint is empty or nullpublic void close()