2
2
3
3
![ aws provider] ( https://img.shields.io/badge/provider-AWS-orange?logo=amazon-aws&color=ff9900 )
4
4
5
-
6
5
A suite of utilities for AWS Lambda Functions that makes tracing with AWS X-Ray, structured logging and creating custom metrics asynchronously easier.
7
6
8
7
** [ 📜Documentation] ( https://awslabs.github.io/aws-lambda-powertools-java/ ) ** | ** [ Feature request] ( https://github.com/awslabs/aws-lambda-powertools-java/issues/new?assignees=&labels=feature-request%2C+triage&template=feature_request.md&title= ) ** | ** [ 🐛Bug Report] ( https://github.com/awslabs/aws-lambda-powertools-java/issues/new?assignees=&labels=bug%2C+triage&template=bug_report.md&title= ) ** | ** [ Detailed blog post] ( https://aws.amazon.com/blogs/opensource/simplifying-serverless-best-practices-with-lambda-powertools/ ) **
@@ -27,6 +26,9 @@ Powertools is available in Maven Central. You can use your favourite dependency
27
26
And configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lambda-powertools-java aspects into your project:
28
27
29
28
``` xml
29
+ <build >
30
+ <plugins >
31
+ ...
30
32
<plugin >
31
33
<groupId >com.nickwongdev</groupId >
32
34
<artifactId >aspectj-maven-plugin</artifactId >
@@ -50,25 +52,37 @@ And configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lambd
50
52
</execution >
51
53
</executions >
52
54
</plugin >
53
-
54
- ```
55
- * [ gradle ] ( https://gradle.org/ ) :
55
+ ...
56
+ </ plugins >
57
+ </ build >
56
58
```
57
- repositories {
58
- mavenCentral()
59
- }
60
59
61
- dependencies {
62
- powertools 'software.amazon.lambda:aws-lambda-powertools-java:YOUR_REQUIRED_VERSION'
63
- }
60
+ ### Logging Configuration
61
+ Powertools extends the functionality of Log4J. Below is an example ` log4j2.xml ` file, with the ` LambdaJsonLayout ` configured.
62
+
63
+ ``` xml
64
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
65
+ <Configuration packages =" com.amazonaws.services.lambda.runtime.log4j2" >
66
+ <Appenders >
67
+ <Console name =" JsonAppender" target =" SYSTEM_OUT" >
68
+ <LambdaJsonLayout compact =" true" eventEol =" true" />
69
+ </Console >
70
+ </Appenders >
71
+ <Loggers >
72
+ <Logger name =" JsonLogger" level =" INFO" additivity =" false" >
73
+ <AppenderRef ref =" JsonAppender" />
74
+ </Logger >
75
+ <Root level =" info" >
76
+ <AppenderRef ref =" JsonAppender" />
77
+ </Root >
78
+ </Loggers >
79
+ </Configuration >
64
80
```
65
81
66
82
## Credits
67
83
68
- * Structured logging initial implementation from [ aws-lambda-logging] ( https://gitlab.com/hadrien/aws_lambda_logging )
69
- * Powertools idea [ DAZN Powertools] ( https://github.com/getndazn/dazn-lambda-powertools/ )
70
84
* [ Gatsby Apollo Theme for Docs] ( https://github.com/apollographql/gatsby-theme-apollo/tree/master/packages/gatsby-theme-apollo-docs )
71
85
72
86
## License
73
87
74
- This library is licensed under the MIT-0 License. See the LICENSE file.
88
+ This library is licensed under the Apache License, Version 2.0 . See the LICENSE file.
0 commit comments