Step 1: Install
Install option 1: Maven
Add the javabrake dependency through your IDE or directly to your pom.xml file:
<dependency>
<groupId>io.airbrake</groupId>
<artifactId>javabrake</artifactId>
<version>0.1.6</version>
</dependency>
Install option 2: Gradle
Add javabrake to your Gradle dependencies:
compile 'io.airbrake:javabrake:0.1.6'
Install option 3: Ivy
Add javabrake to your Ivy dependencies:
<dependencyorg='io.airbrake'name='javabrake'rev='0.1.6'>
<artifactname='javabrake'ext='pom'></artifact>
</dependency>
Step 2: Configure
Import the javabrake library and copy the three configuration lines into your
app to send all uncaught exceptions to Airbrake:
(You can find your project API KEY with your project's settings)
// Import the library:importio.airbrake.javabrake.Notifier;
publicclassExampleApp {
publicstaticvoidmain(String[] args) {
// Copy configuration lines:intprojectId = <YourprojectID>;
StringprojectKey = "<Your project API KEY>";
Notifiernotifier = newNotifier(projectId, projectKey);
}
}Example of reporting a caught exception:
try {
inti = 1/0;
} catch (ArithmeticExceptione) {
notifier.report(e);
}Visit our official GitHub repo for advanced information and integrations like log4j, log4j2, and logback.
Step 1: Install
Install option 1: Maven
Add the javabrake dependency through your IDE or directly to your
pom.xmlfile:Install option 2: Gradle
Add javabrake to your Gradle dependencies:
Install option 3: Ivy
Add javabrake to your Ivy dependencies:
Step 2: Configure
Import the javabrake library and copy the three configuration lines into your
app to send all uncaught exceptions to Airbrake:
(You can find your project API KEY with your project's settings)
Example of reporting a caught exception:
Visit our official GitHub repo for advanced information and integrations like log4j, log4j2, and logback.