An open API service indexing awesome lists of open source software.

https://github.com/exabrial/logback-jms-appender

Logback JMS Appender. Send your logs reliably over JMS!
https://github.com/exabrial/logback-jms-appender

java javaee jms logback logging slf4j

Last synced: about 2 months ago
JSON representation

Logback JMS Appender. Send your logs reliably over JMS!

Awesome Lists containing this project

README

          

# Logback JMS Appender
Provides a way to send all your logback messages over JMS to a queue! Take advantage of reliable messaging and buffering already built into your app and use it for logging. Bridges `YourApp->ActiveMQ` (or your server's JMS provider)

This plugin performs a JNDI lookup to a JMS connection factory. It requires at least Java EE 7.

If you're using ActiveMQ and Graylog, consider taking a look at my ActiveMQ Input Plugin to bridge ActiveMQ->Graylog. https://github.com/exabrial/graylog-plugin-openwire

## License
All files are Licensed Apache Source License 2.0. Please consider contributing back any changes you may make, thanks!

## Usage

The default `com.github.exabrial.logback.JmsAppender` will work almost-out-of-the-box with Apache TomEE/OpenEJB and send logging events to the `ch.qos.logback` queue. It will attempt to lookup a jms connection factory named `jms/connectionFactory`, which you should create in your tomee.xml.

### Maven Coordinates

```

com.github.exabrial
logback-jms-appender
1.1.0
runtime

```

If you're logging to Graylog I suggest you also use a GELF encoder:

```

de.siegmar
logback-gelf
3.0.0
runtime

```

## Configuration

| Property Name | Default | Purpose |
|------------------------------|------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|
| initialContextFactory | org.apache.openejb.client.LocalInitialContextFactory | Each Java EE server will have a different InitialContext class to use. You'll find this in your server's documentation. |
| jmsConnectionFactoryJndiName | openejb:Resource/jms/connectionFactory | This is passed to the initial context factory to perform the lookup. Different servers will keep resources in different places. |
| queueName | ch.qos.logback | The JMS Queue name to send messages to. |
| async | false | Use an ArrayBlockingQueue as a buffer. Messages will be sent in another thread. Message overflows are dumped to `System.err` after waiting 25ms. A JMX is registered to monitor stats. While the default here is `false` for backwards compatibility, it's highly recommend you set this to `true`. |
| asyncBufferSize | 256 | If `async=true`, this is size of the ArrayBlockingQueue. It is recommended to leave this as is. Monitor JMX for writeStalls and messagesDropped if changed. |

### Example Configuration

This configuration uses the GELF encoder mentioned earlier (since I send my logging events to Graylog), but any Logback encoder could be used. Note you should replace `${project.artifactId}` below:

```

your-app-name


true
com.emoneyusa.logback

true
true
true

%.100ex{short}%.100m


%msg

app:${project.artifactId}





```