Logback Mattermost Appender

Logback appender for sending messages to Mattermost chats.

License

License

Categories

Categories

Logback Application Layer Libs Logging
GroupId

GroupId

com.github.rafelbev
ArtifactId

ArtifactId

logback-mattermost-appender
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

Logback Mattermost Appender
Logback appender for sending messages to Mattermost chats.
Project URL

Project URL

https://github.com/rafelbev/logback-mattermost-appender
Source Code Management

Source Code Management

https://github.com/rafelbev/logback-mattermost-appender

Download logback-mattermost-appender

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.rafelbev/logback-mattermost-appender/ -->
<dependency>
    <groupId>com.github.rafelbev</groupId>
    <artifactId>logback-mattermost-appender</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.rafelbev/logback-mattermost-appender/
implementation 'com.github.rafelbev:logback-mattermost-appender:1.0.0'
// https://jarcasting.com/artifacts/com.github.rafelbev/logback-mattermost-appender/
implementation ("com.github.rafelbev:logback-mattermost-appender:1.0.0")
'com.github.rafelbev:logback-mattermost-appender:jar:1.0.0'
<dependency org="com.github.rafelbev" name="logback-mattermost-appender" rev="1.0.0">
  <artifact name="logback-mattermost-appender" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.rafelbev', module='logback-mattermost-appender', version='1.0.0')
)
libraryDependencies += "com.github.rafelbev" % "logback-mattermost-appender" % "1.0.0"
[com.github.rafelbev/logback-mattermost-appender "1.0.0"]

Dependencies

compile (3)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.1.2
com.fasterxml.jackson.core : jackson-databind jar 2.6.6
org.apache.commons : commons-lang3 jar RELEASE

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

This is a simple Logback appender which pushes logs to a Mattermost channel.

How to setup

Add dependency to com.github.rafelbev:logback-mattermost-appender:1.0.0 in your pom.xml.

Add MattermostAppender configuration to logback.xml file

	<?xml version="1.0" encoding="UTF-8" ?>
	<configuration>
		...
		<appender name="MATTERMOST" class="com.github.rafelbev.logback.MattermostAppender">
			<!-- Mattermost incoming webhook uri. Uncomment the lines below to use incoming webhook uri instead of API token. -->
			<webhookUri>https://mattermost.server.com/hooks/XXXXXXXXXXXXXXXXXXXXXXXX</webhookUri>
			<!-- Channel that you want to post to -->
			<channel>#api-test</channel>
			<!-- Formatting (you can use Mattermost formatting - URL links, code formatting, etc.) -->
			<layout class="ch.qos.logback.classic.PatternLayout">
				<pattern>%m\nLogLevel: %-5level\nClass: %logger{2}\n</pattern>
			</layout>
			<!-- Username of the messages sender -->
			<username>${HOSTNAME}</username>
			<!-- Icon to use in template -->
			<iconUri>https://logback.qos.ch/images/logos/lblogo.jpg</iconUri>
		</appender>

		<!-- Currently recommended way of using Mattermost appender -->
		<appender name="ASYNC_MATTERMOST" class="ch.qos.logback.classic.AsyncAppender">
			<appender-ref ref="MATTERMOST" />
			<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
				<level>ERROR</level>
			</filter>
		</appender>

		<root>
			<level value="ALL" />
			<appender-ref ref="ASYNC_MATTERMOST" />
		</root>

	</configuration>

Versions

Version
1.0.0