Skip to content

Library for the creation of Appenders for Log4j

License

Notifications You must be signed in to change notification settings

Chavaillaz/common-log4j-appender

Repository files navigation

Common Log4j Appender

Quality Gate Dependency Check Maven Central License

This library helps you to easily create Appenders for Log4j.

Installation

The dependency is available in maven central (see badge for version):

<dependency>
    <groupId>com.chavaillaz</groupId>
    <artifactId>common-log4j-appender</artifactId>
</dependency>

Usage

Three classes will be needed to create your appender:

  • Implementing LogDelivery or extending AbstractBatchLogDelivery to ship the logs with the following methods:
    • send: Send a log event (possibly stacked before being sent)
    • flush: Flush any buffer to send all remaining log events
  • Extending AbstractLogDeliveryAppender to create the appender with the following methods:
    • createLogDeliveryHandler: Create a new instance of your log delivery above
    • createLogDeliveryTask: Create a new instance of a log delivery task to send a log event
  • Implementing LogConfiguration to configure the appender, by adding any configuration needed for the log shipping

Example

Two implementation examples are available:

Contributing

If you have a feature request or found a bug, you can:

  • Write an issue
  • Create a pull request

If you want to contribute then

  • Please write tests covering all your changes
  • Ensure you didn't break the build by running mvn test
  • Fork the repo and create a pull request

License

This project is under Apache 2.0 License.

About

Library for the creation of Appenders for Log4j

Resources

License

Stars

Watchers

Forks

Packages

No packages published