Introduce Rollbar and Slack for realtime exception alerts

Quickly responding to new, reactivated, and otherwise important exceptions is a critical part of adopting continuous delivery and other DevOps best practices.

Rollbar provides code version-specific dashboards and a live feed for proactively monitoring for exceptions during a deploy, but for those exceptions that happen when you aren’t actively watching Rollbar, our Slack integration is the most popular way to get real-time alerts.

Connect Rollbar with Github

Create a project

Create the project from a Github repo directly or specify the new project information to create.

Integrate a notifier

Wait the data

Integrate source control

Project integration

<!-- Rollbar -->
<dependency>
<groupId>com.rollbar</groupId>
<version>[1.0,)</version>
<artifactId>rollbar-java</artifactId>
</dependency>
<dependency>
<groupId>com.rollbar</groupId>
<artifactId>rollbar-logback</artifactId>
<version>1.3.1</version>
</dependency>

Logback configuration

<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<contextName>logback</contextName>

<appender name="ROLLBAR" class="com.rollbar.logback.RollbarAppender">
<accessToken>ec6e37c277c940dcb5d4bcf879fa425c</accessToken>
<environment>Dev</environment>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>warn</level>
</filter>
</appender>

<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%date %level [%thread] %-5level %logger{36} [%file:%line] - %msg%n</pattern>
</encoder>
</appender>

<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/agriculture.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>1</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%date %level [%thread] %-5level %logger{36} [%file:%line] - %msg%n</pattern>
</encoder>
</appender>

<root level="info">
<appender-ref ref="console" />
<appender-ref ref="file" />
<appender-ref ref="ROLLBAR" />
</root>

<shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
</configuration>

The access token can be copied from the the settings of the Rollbar project.

Test integration with Rollbar

org.slf4j.Logger logger = LoggerFactory.getLogger(Test.class);
try {
throw new IllegalArgumentException("This is a test for Rollbar.");
} catch (IllegalArgumentException e) {
logger.error("error", e);
}

Check dashboard status

Integrate Rollbar notification with Slack

Add Rollbar app in Slack

Enable Slack integration

Slack channel selection

Configure Slack app rules

Test integration with Slack

Slack channel settings

Researcher | Architect | Full-Stack | @hustakin

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store