Introduce Rollbar and Slack for realtime exception alerts

Connect Rollbar with Github

Create a project

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>

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

--

--

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