-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [alc] Log4j2 support * [log4j2] bump aws-lambda-java-core deps to 1.2.3 * [log4j2] version bump and doc updates --------- Co-authored-by: Daniel Torok <[email protected]>
- Loading branch information
Showing
8 changed files
with
169 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...a-log4j2/src/main/java/com/amazonaws/services/lambda/runtime/log4j2/LambdaJsonFormat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ | ||
|
||
package com.amazonaws.services.lambda.runtime.log4j2; | ||
|
||
import org.apache.logging.log4j.core.Layout; | ||
import org.apache.logging.log4j.core.config.plugins.Plugin; | ||
import org.apache.logging.log4j.core.config.plugins.PluginElement; | ||
import org.apache.logging.log4j.core.config.plugins.PluginFactory; | ||
|
||
import java.io.Serializable; | ||
|
||
@Plugin(name = "LambdaJsonFormat", category = "core", printObject = true) | ||
public class LambdaJsonFormat { | ||
|
||
private Layout layout; | ||
|
||
@PluginFactory | ||
public static LambdaJsonFormat createNode(@PluginElement("Layout") Layout<? extends Serializable> layout) { | ||
return new LambdaJsonFormat(layout); | ||
} | ||
|
||
private LambdaJsonFormat(Layout layout) { | ||
this.layout = layout; | ||
} | ||
|
||
public Layout getLayout() { | ||
return layout; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...a-log4j2/src/main/java/com/amazonaws/services/lambda/runtime/log4j2/LambdaTextFormat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. */ | ||
|
||
package com.amazonaws.services.lambda.runtime.log4j2; | ||
|
||
import org.apache.logging.log4j.core.Layout; | ||
import org.apache.logging.log4j.core.config.plugins.Plugin; | ||
import org.apache.logging.log4j.core.config.plugins.PluginElement; | ||
import org.apache.logging.log4j.core.config.plugins.PluginFactory; | ||
|
||
import java.io.Serializable; | ||
|
||
@Plugin(name = "LambdaTextFormat", category = "core", printObject = true) | ||
public class LambdaTextFormat { | ||
|
||
private Layout layout; | ||
|
||
@PluginFactory | ||
public static LambdaTextFormat createNode(@PluginElement("Layout") Layout<? extends Serializable> layout) { | ||
return new LambdaTextFormat(layout); | ||
} | ||
|
||
private LambdaTextFormat(Layout layout) { | ||
this.layout = layout; | ||
} | ||
|
||
public Layout getLayout() { | ||
return layout; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
aws-lambda-java-log4j2/src/main/resources/LambdaLayout.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"timestamp": { | ||
"$resolver": "timestamp", | ||
"pattern": { | ||
"format": "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", | ||
"timeZone": "UTC" | ||
} | ||
}, | ||
"level": { | ||
"$resolver": "level", | ||
"field": "name" | ||
}, | ||
"message": { | ||
"$resolver": "message" | ||
}, | ||
"logger": { | ||
"$resolver": "logger", | ||
"field": "name" | ||
}, | ||
|
||
"errorType": { | ||
"$resolver": "exception", | ||
"field": "className" | ||
}, | ||
"errorMessage": { | ||
"$resolver": "exception", | ||
"field": "message" | ||
}, | ||
"stackTrace": { | ||
"$resolver": "exception", | ||
"field": "stackTrace" | ||
}, | ||
|
||
"labels": { | ||
"$resolver": "mdc", | ||
"flatten": true, | ||
"stringified": true | ||
} | ||
} |