Log4j Redis Appender

log4j appender for publishing directly to redis

License

License

Categories

Categories

Ant Build Tools Redis Data Databases
GroupId

GroupId

com.ryantenney.log4j
ArtifactId

ArtifactId

redis-appender
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Log4j Redis Appender
log4j appender for publishing directly to redis
Project URL

Project URL

http://github.com/ryantenney/log4j-redis-appender/
Source Code Management

Source Code Management

https://github.com/ryantenney/log4j-redis-appender/

Download redis-appender

How to add to project

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

Dependencies

compile (1)

Group / Artifact Type Version
redis.clients : jedis jar 2.1.0

provided (1)

Group / Artifact Type Version
log4j : log4j jar 1.2.17

test (2)

Group / Artifact Type Version
net.logstash.log4j : jsonevent-layout jar 1.0
junit : junit jar 4.10

Project Modules

There are no modules declared in this project.

log4j-redis-appender Build Status

Log4j appender for pushing log messages to a Redis list.

Derived from @pavlobaron's log4j2redis, though the two projects share almost no code. That project writes messages to unique keys as opposed to pushing to a list.

Configuration

This appender pushes log messages to a Redis list. Here is an example configuration:

log4j.rootLogger=DEBUG, redis
log4j.appender.redis=com.ryantenney.log4j.RedisAppender
log4j.appender.redis.layout=…
log4j.appender.redis.host=localhost
log4j.appender.redis.port=6379
log4j.appender.redis.password=password
log4j.appender.redis.key=key
log4j.appender.redis.period=500
log4j.appender.redis.batchSize=100
log4j.appender.redis.purgeOnFailure=true
log4j.appender.redis.alwaysBatch=true
log4j.appender.redis.daemonThread=true

Where:

  • key (required) key of the list to push log messages
  • host (optional, default: localhost)
  • port (optional, default: 6379)
  • password (optional) redis password, if required
  • period (optional, default: 500) the period in milliseconds between
  • batchSize (optional, default: 100) the number of log messages to send in a single RPUSH command
  • purgeOnFailure (optional, default: true) whether to purge the enqueued log messages if an error occurs attempting to connect to redis, thus preventing the memory usage from becoming too high
  • alwaysBatch (optional, default: true) whether to wait for a full batch. if true, will only send once there are batchSize log messages enqueued
  • daemonThread (optional, default: true) whether to launch the appender thread as a daemon thread

Maven

<dependency>
	<groupId>com.ryantenney.log4j</groupId>
	<artifactId>redis-appender</artifactId>
	<version>1.0.1</version>
</dependency>

Usage Note

Goes great with @lusis's log4j-jsonevent-layout for pushing log messages straight to a Logstash instance configured to ingest log messages from Redis. If you use Logstash with AMQP, check out @lusis's ZeroMQ Appender or @jbrisbin's RabbitMQ Appender

License

Copyright (c) 2012-2013 Ryan Tenney

Published under Apache Software License 2.0, see LICENSE

Rochester Made

Versions

Version
1.0.1
1.0.0