Appenders for Log4J 1.2.x that write to AWS destinations
Clone or download
Latest commit 07399b3 Sep 9, 2018
Permalink
Failed to load latest commit information.
appenders release 1.3.0 Sep 9, 2018
docs release 1.3.0 Sep 9, 2018
example release 1.3.0 Sep 9, 2018
tests release 1.3.0 Sep 9, 2018
.gitignore Implement roll() (#3) Jun 24, 2017
CHANGES.md release 1.3.0 Sep 9, 2018
LICENSE Initial commit Mar 10, 2017
README.md release 1.3.0 Sep 9, 2018

README.md

log4j-aws-appenders

Appenders for Log4J 1.x that write to various AWS destinations:

In addition to the appenders, this library includes:

  • JsonLayout, which lets you send data to an Elasticsearch/Kibana cluster without the need for parsing.
  • StatisticsMBean, which allows the appenders to report operational data via JMX.

Usage

To use these appenders, include the aws-appenders JAR in your project along with Log4J and the relevant AWS JAR(s), then configure the desired appender in your Log4J properties. Each appender's documentation describes the complete set of configuration properties and shows a typical configuration.

There is also an example project that exercises all of the appenders.

Getting the JAR

Released versions of the appenders are uploaded to Maven Central. You can find them here.

Versions

I follow the standard MAJOR.MINOR.PATCH versioning scheme:

  • MAJOR is currently 1. I am considering support for additional logging frameworks, at which point it will change to 2.
  • MINOR is incremented for each change that adds signficant functionality or changes the behavior of existing functionality in non-backwards-compatible ways. The API does not break backwards compatibility for minor releases, so your configurations can remain the same.
  • PATCH is incremented for reflect bugfixes or additional features that don't change the existing behavior (although they may add behavior).

Dependencies

To avoid dependency hell, all dependencies are marked as "provided": you will need to ensure that your project includes necessary dependencies, as follows:

  • log4j
  • aws-java-sdk-logs to use CloudWatchAppender
  • aws-java-sdk-kinesis to use KinesisAppender
  • aws-java-sdk-sns to use SNSAppender
  • aws-java-sdk-sts to use the aws:accountId substitution variable (typically used with SNSAppender)

The minimum supported dependency versions are:

  • JDK: 1.6 The build script generates 1.6-compatible classfiles, and the appender code does not rely on standard libary classes/methods introduced after 1.6. As-of this release, I have verified that I can run (but not build) the example program using OpenJDK 1.6. Beware, however: Amazon releases the SDK on a daily basis, and a newer release may require a later JVM.
  • Log4J: 1.2.16 This is the first version that implements LoggingEvent.getTimeStamp(), which is needed to order messages when sending to AWS. It's been around since 2010, so if you haven't upgraded already you should.
  • AWS SDK: 1.11.0 The appenders will work with all releases in the 1.11.x sequence. If you're using a version that has client builders, they will be used to create service clients; if not, the default client constructors will be used. For more information, see the FAQ.

I have made an intentional effort to limit dependencies to the bare minimum. This has in some cases meant that I write internal implementations for functions that are found in common libraries.

For more information

Release History

Frequently Asked Questions

Design Documentation

If you want to build it yourself