Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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,41 @@
/*
* 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.Logging;
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) {
PowertoolsLogging.initializeLogging(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