View on GitHub

Slack Logger

Slack Logger is a custom log4j appender which logs directly to a Slack channel

Download this project as a .zip file Download this project as a tar.gz file

Slack Logger

Download

Slack Logger is a custom log4j appender which logs directly to a Slack channel.

Slack Logger

Requirements

Setup

Slack

Config

All config items contain the prefix grails.plugin.slacklogger.

NOTE: Config items with * after them are secret information. It is highly reccommended to put this information in secret files and pull it into the Grails project at runtime.

Use

Slack Logger creates a new Logback appender which can be used like a normal appender in logback.groovy. Below is an example configuration of a new appender:

import com.theconnman.slacklogger.SlackAppender
...
appender('SLACK', SlackAppender) {
    encoder(PatternLayoutEncoder) {
        pattern = "%logger - %msg%n"
    }
}

The appender pattern above will produce messages which look like the image at the top of the readme. Removing the time and the level from the log pattern is recommended because the time and level will appear on the Slack message by default.

Development

To run the project in development clone the repository and run the following:

grails-app -Dgrails.SLACK_WEBHOOK=[your Slack webhook] run-app

Then go to http:/localhost:8080/test to receive a test message.