Skip to content

#114: Update README.md file for Gradle and SAM tools #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions aws-lambda-java-log4j2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,32 @@ If using maven shade plugin, set the plugin configuration as follows
</plugins>
```

If you are using the [John Rengelman](https://github.com/johnrengelman/shadow) Gradle shadow plugin, then the plugin configuration is as follows:

```groovy

dependencies{
...
implementation group: 'com.amazonaws', name: 'aws-lambda-java-log4j2', version: '1.1.0'
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: log4jVersion
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: log4jVersion
}

jar {
enabled = false
}
shadowJar {
transform(com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer)
}

build.dependsOn(shadowJar)

```

If you are using the `sam build` and `sam deploy` commands to deploy your lambda function, then you don't
need to use the shadow jar plugin. The `sam` cli-tool merges itself the `Log4j2Plugins.dat`
files.

### 2. Configure log4j2 using log4j2.xml file

Add the following file `<project-dir>/src/main/resources/log4j2.xml`
Expand Down