Skip to content

Commit a353c54

Browse files
committed
aws#114: Update README.md file for Gradle and SAM tools
1 parent 58facf2 commit a353c54

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

aws-lambda-java-log4j2/README.md

+27
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,33 @@ 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+
implementation group: 'org.apache.logging.log4j', name: 'log4j-slf4j18-impl', version: log4jVersion
75+
}
76+
77+
jar {
78+
enabled = false
79+
}
80+
shadowJar {
81+
transform(com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer)
82+
}
83+
84+
build.dependsOn(shadowJar)
85+
86+
```
87+
88+
If you are using the `sam build` and `sam deploy` commands to deploy your lambda function, then you don't
89+
need to use the shadow jar plugin. The `sam` cli-tool merges itself the `Log4j2Plugins.dat`
90+
files.
91+
6592
### 2. Configure log4j2 using log4j2.xml file
6693

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

0 commit comments

Comments
 (0)