Skip to content

A shadow plugin transformer implementation for log4j to concatenate Log4j2Plugins.dat files.

License

Notifications You must be signed in to change notification settings

robbie-williams/shadow-log4j-transformer

 
 

Repository files navigation

Log4j 2 Transformer for Gradle Shadow Plugin

A shadow plugin transformer implementation for log4j to concatenate Log4j2Plugins.dat files.

This is a port of the maven-shaded-log4j-transformer.

Versioning Scheme

The version numbering scheme is has the following format: SHADOW_MAJOR.MINOR.PATCH. This is no real semantic versioning because the SHADOW_MAJOR version number correspond to the MAJOR shadow plugin version number.

At the time of writing, the latest shadow plugin version was 2.0.0. Therefore, you should use this plugin's version starting with 2. If you are stuck at version 1.2.4 use the plugin version starting with 1.

Latest Version

Download
The latest plugin version is 2.1.1. It requires at least Java 7.

You can get version notifications on bintray:
Get automatic notifications about new "shadow-log4j-transformer" versions

Adding the plugin to your project

This plugin must work with the shadow plugin and will use Log4j 2.

You can use this plugin as library or gradle plugin.

Usage as library

The plugin can be used as library to provide the Log4j 2 transformer. This is as easy as shown below:

buildscript {
  dependencies {
    classpath "com.github.jengelman.gradle.plugins:shadow:2.0.0"
    classpath 'de.sebastianboegl.gradle.plugins:shadow-log4j-transformer:2.1.1'
  }
}

apply plugin: 'com.github.johnrengelman.shadow'

shadowJar {
  transform(de.sebastianboegl.gradle.plugins.shadow.transformers.Log4j2PluginsFileTransformer)
}

Using the apply method

The plugin applies the latest version of the shadow plugin or the one in the dependency block, hence, you don't have to apply the shadow plugin.

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "com.github.jengelman.gradle.plugins:shadow:2.0.0"
    classpath "de.sebastianboegl.gradle.plugins:shadow-log4j-transformer:2.1.1"
  }
}

apply plugin: "de.sebastianboegl.shadow.transformer.log4j"

Using the Gradle plugin DSL

The order of the plugins doesn't matter:

plugins {
  id "com.github.johnrengelman.shadow" version "2.0.0"
  id "de.sebastianboegl.shadow.transformer.log4j" version "2.1.1"
}

Configuration

There is no configuration needed. The plugin adds itself as Transformer (see the shadow plugin documentation Section Controlling JAR Content Merging).

About

A shadow plugin transformer implementation for log4j to concatenate Log4j2Plugins.dat files.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Groovy 100.0%