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!
- Host: GitHub
- URL: https://github.com/exabrial/logback-jms-appender
- Owner: exabrial
- License: apache-2.0
- Created: 2018-09-09T01:37:57.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-07-27T16:24:17.000Z (over 3 years ago)
- Last Synced: 2025-08-04T15:28:39.509Z (7 months ago)
- Topics: java, javaee, jms, logback, logging, slf4j
- Language: Java
- Homepage:
- Size: 29.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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}
```