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
* Util method to add multiple custom keys to logs
* test case for log level overrride via env variable
Co-authored-by: Pankaj Agrawal <[email protected]>
Copy file name to clipboardExpand all lines: docs/content/core/logging.mdx
+22
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,20 @@ Powertools extends the functionality of Log4J. Below is an example log4j2.xml fi
37
37
</Configuration>
38
38
```
39
39
40
+
You can also override log level by setting `LOG_LEVEL` env var - Here is an example using AWS Serverless Application Model (SAM)
41
+
42
+
```yaml:title=template.yaml
43
+
Resources:
44
+
HelloWorldFunction:
45
+
Type: AWS::Serverless::Function
46
+
Properties:
47
+
...
48
+
Runtime: java8
49
+
Environment:
50
+
Variables:
51
+
LOG_LEVEL: DEBUG # highlight-line
52
+
```
53
+
40
54
You can also explicitly set a service name via `POWERTOOLS_SERVICE_NAME` env var. This sets **service** key that will be present across all log statements.
41
55
42
56
## Standard structured keys
@@ -137,6 +151,14 @@ public class App implements RequestHandler<APIGatewayProxyRequestEvent, APIGatew
Copy file name to clipboardExpand all lines: powertools-logging/src/main/java/software/amazon/lambda/powertools/logging/internal/LambdaLoggingAspect.java
Copy file name to clipboardExpand all lines: powertools-logging/src/test/java/software/amazon/lambda/powertools/logging/handlers/PowerLogToolEnabled.java
+1
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@ public class PowerLogToolEnabled implements RequestHandler<Object, Object> {
0 commit comments