gmethvin / logslack   0.0.3

Apache License 2.0 GitHub

A Logback appender to write messages to Slack channels based on Markers

Scala versions: 2.12 2.11

Logslack: Logback appender for Slack

Travis CI Maven

Logslack is a Logback appender that posts log messages to Slack. Since you generally don't want to send all logs to Slack, it allows selectively directing log messages to Slack channels by passing a Marker.

The library is written in Scala, using an Akka HTTP client to make requests asynchronously to the Slack API.


In sbt:

libraryDependencies += "io.methvin" %% "logslack" % logslackVersion

In maven:


Replace the logslackVersion with the version (Maven).


To enable, add the appender to your logback.xml, providing at least a token:

  <appender name="SLACK" class="io.methvin.logback.SlackAppender">
    <!-- The app's slack API token. This must have at least the "" permission. -->

    <!-- If you set the channel option, ALL logs will go to this channel. -->
    <!-- <channel>#application-logs</channel> -->

    <!-- The emoji to use as the icon for this message (must start and end in a colon) -->
    <!-- <iconEmoji>:shrug:</iconEmoji> -->

    <!-- The bot's username. -->
    <!-- <username>logger</username> -->

    <!-- Whether Slack should use markdown to process the log messages. Defaults to true. -->
    <!-- <useMarkdown>false</useMarkdown> -->

    <!-- Only log above a certain threshold to slack -->
    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">

    <!-- Formatting -->
    <layout class="ch.qos.logback.classic.PatternLayout">
      <pattern>%-4relative [%thread] %-5level %class - %msg%n</pattern>

  <root level="INFO">
    <appender-ref ref="SLACK" />


With the above configuration, logslack will not post to any slack channels by default. You can create a SLF4J Marker to tag a log message for a specific channel. For example:

object SlackMarkers {
  final val GeneralAlerts = MarkerFactory.getMarker("#general-alerts")

The name of the marker should be the same as the channel you wish to post to.

Then specify the marker when logging:

// for a standard SLF4J logger:, "Something happened!")

// for Play logger:"Something happened!")(SlackMarkers.GeneralAlerts)

To log all messages in some channel, set the channel option in the configuration, described in the configuration section above.