Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
397a2d9
Initial version of PowertoolsLogging.initializeLogging API.
phipag Oct 16, 2025
cd4e7a1
Add logging-function E2E tests for new PowertoolsLogging.initializeLo…
phipag Oct 17, 2025
c7fbbbc
Add service name env var for powertools-logging unit tests.
phipag Oct 17, 2025
d6e0051
Merge branch 'main' into phipag/logging-imperative-style
phipag Oct 17, 2025
5187199
Catch NoSuchFileException instead of IOException base class in KeyBuf…
phipag Oct 17, 2025
8de1d3c
Catch NoSuchFileException also on cleanup since order of test executi…
phipag Oct 17, 2025
5ea73ab
Fix spotbugs issue. This is intended design to support unit tests. Th…
phipag Oct 17, 2025
7980798
Reduce cognitive complexity of LambdaLoggingAspect.
phipag Oct 17, 2025
decac5a
Suppress sonar findings needed for internal unit tests.
phipag Oct 17, 2025
12a0d43
Add naming convention findings to sonar ignore list.
phipag Oct 17, 2025
d781483
Make PowertoolsLogging thread-safe.
phipag Oct 17, 2025
9281ceb
Make cold start tracking thread-safe.
phipag Oct 20, 2025
21df606
Merge branch 'main' into phipag/logging-imperative-style
phipag Oct 21, 2025
7aed484
Merge branch 'main' into phipag/logging-imperative-style
phipag Oct 21, 2025
a9492bb
Update protobuf generated classes after version bump.
phipag Oct 21, 2025
17df20d
Add merged version bump to non-release e2e logging function handler.
phipag Oct 21, 2025
7906658
Merge branch 'main' into phipag/logging-imperative-style
phipag Oct 21, 2025
a780741
Merge branch 'main' into phipag/logging-imperative-style
phipag Oct 27, 2025
6c5450d
Add withLogging callback based interface to PowertoolsLogging.
phipag Oct 27, 2025
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions powertools-e2e-tests/handlers/logging-functional/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>software.amazon.lambda</groupId>
<artifactId>e2e-test-handlers-parent</artifactId>
<version>2.5.0</version>
</parent>

<artifactId>e2e-test-handler-logging-functional</artifactId>
<packaging>jar</packaging>
<name>E2E test handler – Logging Functional</name>

<dependencies>
<dependency>
<groupId>software.amazon.lambda</groupId>
<artifactId>powertools-logging-log4j</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.lambda</groupId>
<artifactId>powertools-logging</artifactId>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-events</artifactId>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-runtime-interface-client</artifactId>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-core</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>native-image</id>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package software.amazon.lambda.powertools.e2e;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;

import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;

import software.amazon.lambda.powertools.logging.PowertoolsLogging;

public class Function implements RequestHandler<Input, String> {
private static final Logger LOG = LoggerFactory.getLogger(Function.class);

public String handleRequest(Input input, Context context) {
return PowertoolsLogging.withLogging(context, () -> {
input.getKeys().forEach(MDC::put);
LOG.info(input.getMessage());

// Flush buffer manually since we buffer at INFO level to test log buffering
PowertoolsLogging.flushBuffer();

return "OK";
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates.
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package software.amazon.lambda.powertools.e2e;

import java.util.Map;

public class Input {
private String message;
private Map<String, String> keys;

public String getMessage() {
return message;
}

public void setMessage(String message) {
this.message = message;
}

public Map<String, String> getKeys() {
return keys;
}

public void setKeys(Map<String, String> keys) {
this.keys = keys;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"name":"com.amazonaws.services.lambda.runtime.LambdaRuntime",
"methods":[{"name":"<init>","parameterTypes":[] }],
"fields":[{"name":"logger"}],
"allPublicMethods":true
},
{
"name":"com.amazonaws.services.lambda.runtime.LambdaRuntimeInternal",
"methods":[{"name":"<init>","parameterTypes":[] }],
"allPublicMethods":true
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[
{
"name": "com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent",
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent$ProxyRequestContext",
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent$RequestIdentity",
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent",
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredClasses": true,
"allPublicClasses": true
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"name":"com.amazonaws.services.lambda.runtime.api.client.runtimeapi.LambdaRuntimeClientException",
"methods":[{"name":"<init>","parameterTypes":["java.lang.String","int"] }]
},
{
"name":"com.amazonaws.services.lambda.runtime.api.client.runtimeapi.dto.InvocationRequest",
"fields":[{"name":"id"}, {"name":"invokedFunctionArn"}, {"name":"deadlineTimeInMs"}, {"name":"xrayTraceId"}, {"name":"clientContext"}, {"name":"cognitoIdentity"}, {"name": "tenantId"}, {"name":"content"}],
"allPublicMethods":true
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Args = --initialize-at-build-time=jdk.xml.internal.SecuritySupport
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[
{
"name": "com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.deser.Deserializers[]"
},
{
"name": "com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.ext.Java7SupportImpl",
"methods": [{ "name": "<init>", "parameterTypes": [] }]
},
{
"name": "com.amazonaws.services.lambda.runtime.LambdaRuntime",
"fields": [{ "name": "logger" }]
},
{
"name": "com.amazonaws.services.lambda.runtime.logging.LogLevel",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredFields": true,
"allPublicFields": true
},
{
"name": "com.amazonaws.services.lambda.runtime.logging.LogFormat",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredFields": true,
"allPublicFields": true
},
{
"name": "java.lang.Void",
"methods": [{ "name": "<init>", "parameterTypes": [] }]
},
{
"name": "java.util.Collections$UnmodifiableMap",
"fields": [{ "name": "m" }]
},
{
"name": "jdk.internal.module.IllegalAccessLogger",
"fields": [{ "name": "logger" }]
},
{
"name": "sun.misc.Unsafe",
"fields": [{ "name": "theUnsafe" }]
},
{
"name": "com.amazonaws.services.lambda.runtime.api.client.runtimeapi.dto.InvocationRequest",
"fields": [
{ "name": "id" },
{ "name": "invokedFunctionArn" },
{ "name": "deadlineTimeInMs" },
{ "name": "xrayTraceId" },
{ "name": "clientContext" },
{ "name": "cognitoIdentity" },
{ "name": "tenantId" },
{ "name": "content" }
],
"allPublicMethods": true
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"resources": {
"includes": [
{
"pattern": "\\Qjni/libaws-lambda-jni.linux-aarch_64.so\\E"
},
{
"pattern": "\\Qjni/libaws-lambda-jni.linux-x86_64.so\\E"
},
{
"pattern": "\\Qjni/libaws-lambda-jni.linux_musl-aarch_64.so\\E"
},
{
"pattern": "\\Qjni/libaws-lambda-jni.linux_musl-x86_64.so\\E"
}
]
},
"bundles": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
{
"name": "com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.deser.Deserializers[]"
},
{
"name": "com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.ext.Java7HandlersImpl",
"methods": [{ "name": "<init>", "parameterTypes": [] }]
},
{
"name": "com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.ext.Java7SupportImpl",
"methods": [{ "name": "<init>", "parameterTypes": [] }]
},
{
"name": "com.amazonaws.lambda.thirdparty.com.fasterxml.jackson.databind.ser.Serializers[]"
},
{
"name": "org.joda.time.DateTime",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredClasses": true,
"allPublicClasses": true
}
]
Loading
Loading