Skip to content

Commit fe73540

Browse files
#114: Update README.md file for Gradle and SAM tools (#115)
1 parent c0a42f6 commit fe73540

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

aws-lambda-java-log4j2/README.md

+26
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,32 @@ If using maven shade plugin, set the plugin configuration as follows
6262
</plugins>
6363
```
6464

65+
If you are using the [John Rengelman](https://github.com/johnrengelman/shadow) Gradle shadow plugin, then the plugin configuration is as follows:
66+
67+
```groovy
68+
69+
dependencies{
70+
...
71+
implementation group: 'com.amazonaws', name: 'aws-lambda-java-log4j2', version: '1.1.0'
72+
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: log4jVersion
73+
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: log4jVersion
74+
}
75+
76+
jar {
77+
enabled = false
78+
}
79+
shadowJar {
80+
transform(com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer)
81+
}
82+
83+
build.dependsOn(shadowJar)
84+
85+
```
86+
87+
If you are using the `sam build` and `sam deploy` commands to deploy your lambda function, then you don't
88+
need to use the shadow jar plugin. The `sam` cli-tool merges itself the `Log4j2Plugins.dat`
89+
files.
90+
6591
### 2. Configure log4j2 using log4j2.xml file
6692

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

0 commit comments

Comments
 (0)