You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+31
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,37 @@ This project follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) fo
8
8
9
9
## [Unreleased]
10
10
11
+
## [1.18.0] - 2023-11-16
12
+
13
+
### Added
14
+
15
+
* feat: add support for [Lambda Advanced Logging Controls (ALC)](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html#monitoring-cloudwatchlogs-advanced) (#1514) by @jeromevdl
16
+
* feat: Add support for POWERTOOLS_LOGGER_LOG_EVENT (#1510) by @AlexeySoshin
17
+
18
+
### Maintenance
19
+
20
+
* fix: json schema 403 error (#1457) by @jeromevdl
21
+
* fix: array jmespath fail in idempotency module (#1420) by @jeromevdl
22
+
* chore: java21 support in our build (#1488) by @jeromevdl
23
+
* chore: Addition of Warn Message If Invalid Annotation Key While Tracing #1511 (#1512) by @jdoherty
24
+
* fix: null namespace should fallback to default namespace (#1506) by @jeromevdl
25
+
* fix: get trace id from system property when env var is not set (#1503) by @mriccia
26
+
* chore: artifacts size on good branches (#1493) by @jeromevdl
27
+
* fix: enforce jackson databind version (#1472) by @jeromevdl
28
+
* chore: add missing projects and improve workflow (#1487) by @jeromevdl
29
+
* chore: Reporting size of the jars in GitHub comments (#1196) by @jeromevdl
30
+
* Deps: Bump third party dependencies to the latest versions.
31
+
32
+
### Documentation
33
+
34
+
* docs(customer-reference): add Vertex Pharmaceuticals as a customer reference (#1486) by @scottgerring
35
+
* docs: Adding Kotlin example. (#1454) by @jasoniharris
36
+
* docs: Terraform example (#1478) by @skal111
37
+
* docs: Add Serveless Framework example (#1363) by @AlexeySoshin
38
+
* docs: Fix link to SQS large message migration guide (#1422) by @scottgerring
39
+
* docs(logging): correct log example keys (#1411) by @walmsles
40
+
* docs: Update gradle configuration readme (#1359) by @scottgerring
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+1-2
Original file line number
Diff line number
Diff line change
@@ -55,8 +55,7 @@ We strongly recommend installing the CheckStyle-IDEA plugin and apply the provid
55
55
2. After installing the plugin, open the preferences (`⌘,` on macOS, or `Ctrl+Alt+S` on Windows/Linux) and search for _Code Style_. Click on the gear icon near the scheme and import checkstyle configuration. Click on "Apply" and "OK".
56
56

57
57
58
-
3. Select the code you've created (module, package, class) and reformat code: `⌘⌥L` (macOS), or `Ctrl+Alt+L` (Windows/Linux):
59
-

58
+
3. Select the code you've created (module, package, class) and reformat code: `⌘⌥L` (macOS), or `Ctrl+Alt+L` (Windows/Linux).
60
59
61
60
4. Apply the reformat, optimize imports, rearrange and cleanup to your code and only to java files:
More info [here](https://github.com/aws-powertools/powertools-lambda-java/pull/1519/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R191).
217
+
218
+
</details>
219
+
193
220
## Examples
194
221
195
-
See the latest release of the **[examples](https://github.com/aws-powertools/powertools-lambda-java/tree/v1.17.0/examples)** for example projects showcasing usage of different utilities.
222
+
See the latest release of the **[examples](https://github.com/aws-powertools/powertools-lambda-java/tree/v1.18.0/examples)** for example projects showcasing usage of different utilities.
196
223
197
224
Have a demo project to contribute which showcase usage of different utilities from powertools? We are happy to accept it [here](CONTRIBUTING.md#security-issue-notifications).
Copy file name to clipboardExpand all lines: docs/core/logging.md
+50-4
Original file line number
Diff line number
Diff line change
@@ -217,9 +217,7 @@ Key | Type | Example | Description
217
217
218
218
## Capturing context Lambda info
219
219
220
-
You can enrich your structured logs with key Lambda context information via `logEvent` annotation parameter.
221
-
You can also explicitly log any incoming event using `logEvent` param. Refer [Override default object mapper](#override-default-object-mapper)
222
-
to customise what is logged.
220
+
When debugging in non-production environments, you can instruct Logger to log the incoming event with `@Logger(logEvent = true)` or via `POWERTOOLS_LOGGER_LOG_EVENT=true` environment variable.
223
221
224
222
!!! warning
225
223
Log event is disabled by default to prevent sensitive info being logged.
@@ -265,7 +263,7 @@ to customise what is logged.
265
263
}
266
264
```
267
265
268
-
### Customising fields in logs
266
+
### Customising fields in logs
269
267
270
268
- Utility by default emits `timestamp` field in the logs in format `yyyy-MM-dd'T'HH:mm:ss.SSSZz` and in system default timezone.
271
269
If you need to customize format and timezone, you can do so by configuring `log4j2.component.properties` and configuring properties as shown in example below:
@@ -598,6 +596,54 @@ via `samplingRate` attribute on annotation.
598
596
POWERTOOLS_LOGGER_SAMPLE_RATE: 0.5
599
597
```
600
598
599
+
## AWS Lambda Advanced Logging Controls (ALC)
600
+
601
+
!!!question "When is it useful?"
602
+
When you want to set a logging policy to drop informational or verbose logs for one or all AWS Lambda functions, regardless of runtime and logger used.
603
+
604
+
<!-- markdownlint-disable MD013 -->
605
+
With [AWS Lambda Advanced Logging Controls (ALC)](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html#monitoring-cloudwatchlogs-advanced){target="_blank"}, you can enforce a minimum log level that Lambda will accept from your application code.
606
+
607
+
When enabled, you should keep `Logger` and ALC log level in sync to avoid data loss.
608
+
609
+
Here's a sequence diagram to demonstrate how ALC will drop both `INFO` and `DEBUG` logs emitted from `Logger`, when ALC log level is stricter than `Logger`.
610
+
<!-- markdownlint-enable MD013 -->
611
+
612
+
```mermaid
613
+
sequenceDiagram
614
+
participant Lambda service
615
+
participant Lambda function
616
+
participant Application Logger
617
+
618
+
Note over Lambda service: AWS_LAMBDA_LOG_LEVEL="WARN"
619
+
Note over Application Logger: POWERTOOLS_LOG_LEVEL="DEBUG"
### Priority of log level settings in Powertools for AWS Lambda
631
+
632
+
We prioritise log level settings in this order:
633
+
634
+
1.`AWS_LAMBDA_LOG_LEVEL` environment variable
635
+
2.`POWERTOOLS_LOG_LEVEL` environment variable
636
+
637
+
If you set `Logger` level lower than ALC, we will emit a warning informing you that your messages will be discarded by Lambda.
638
+
639
+
> **NOTE**
640
+
>
641
+
> With ALC enabled, we are unable to increase the minimum log level below the `AWS_LAMBDA_LOG_LEVEL` environment variable value, see [AWS Lambda service documentation](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html#monitoring-cloudwatchlogs-log-level){target="_blank"} for more details.
642
+
643
+
### Timestamp format
644
+
645
+
When the Advanced Logging Controls feature is enabled, Powertools for AWS Lambda must comply with the timestamp format required by AWS Lambda, which is [RFC3339](https://www.rfc-editor.org/rfc/rfc3339).
646
+
In this case the format will be `yyyy-MM-dd'T'HH:mm:ss.SSS'Z'`.
601
647
602
648
## Upgrade to JsonTemplateLayout from deprecated LambdaJsonLayout configuration in log4j2.xml
Copy file name to clipboardExpand all lines: docs/index.md
+38-1
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Powertools for AWS Lambda (Java) is a suite of utilities for AWS Lambda Function
11
11
Powertools for AWS Lambda is also available for [Python](https://docs.powertools.aws.dev/lambda/python/latest/){target="_blank"}, [TypeScript](https://docs.powertools.aws.dev/lambda/typescript/latest/){target="_blank"}, and [.NET](https://docs.powertools.aws.dev/lambda/dotnet/){target="_blank"}
12
12
13
13
14
-
!!! tip "Looking for a quick run through of the core utilities?"
14
+
???+ tip "Looking for a quick run through of the core utilities?"
15
15
Check out [this detailed blog post](https://aws.amazon.com/blogs/opensource/simplifying-serverless-best-practices-with-aws-lambda-powertools-java/) with a practical example. To dive deeper,
16
16
the [Powertools for AWS Lambda (Java) workshop](https://catalog.us-east-1.prod.workshops.aws/workshops/a7011c82-e4af-4a52-80fa-fcd61f1dacd9/en-US/introduction) is a great next step.
17
17
@@ -274,6 +274,41 @@ Depending on your version of Java (either Java 1.8 or 11+), the configuration sl
274
274
Under the hood, `org.codehaus.mojo:aspectj-maven-plugin` is based on AspectJ 1.9.7,
275
275
while `dev.aspectj:aspectj-maven-plugin` is based on AspectJ 1.9.8, compiled for Java 11+.
276
276
277
+
### Java Compatibility
278
+
Powertools for AWS Lambda (Java) supports all Java version from 8 up to 21 as well as the
For the following modules, Powertools for AWS Lambda (Java) leverages the **aspectj** library to provide annotations:
282
+
- Logging
283
+
- Metrics
284
+
- Tracing
285
+
- Parameters
286
+
- Idempotency
287
+
- Validation
288
+
- Large messages
289
+
290
+
291
+
You may need to add the good version of `aspectjrt` to your dependencies based on the jdk used for building your function:
292
+
293
+
```xml
294
+
<dependency>
295
+
<groupId>org.aspectj</groupId>
296
+
<artifactId>aspectjrt</artifactId>
297
+
<version>1.9.??</version>
298
+
</dependency>
299
+
```
300
+
301
+
Use the following [dependency matrix](https://github.com/eclipse-aspectj/aspectj/blob/master/docs/dist/doc/JavaVersionCompatibility.md) between this library and the JDK:
302
+
303
+
| JDK version | aspectj version |
304
+
|-------------|-----------------|
305
+
|`1.8`|`1.9.7`|
306
+
|`11-17`|`1.9.20.1`|
307
+
|`21`|`1.9.21`|
308
+
309
+
_Note: 1.9.21 is not yet available and Java 21 not yet officially supported by aspectj, but you can already use the `1.9.21.M1`_
310
+
311
+
277
312
## Environment variables
278
313
279
314
!!! info
@@ -285,5 +320,7 @@ Depending on your version of Java (either Java 1.8 or 11+), the configuration sl
285
320
|**POWERTOOLS_METRICS_NAMESPACE**| Sets namespace used for metrics |[Metrics](./core/metrics)|
0 commit comments