Skip to content

Commit 4505213

Browse files
pankajagrawal16Pankaj Agrawal
and
Pankaj Agrawal
authored
fix: powertools specific log level env var to not conflict with the system LOG_LEVEL (#306)
Co-authored-by: Pankaj Agrawal <[email protected]>
1 parent 7f1aac5 commit 4505213

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

docs/content/core/logging.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Powertools extends the functionality of Log4J. Below is an example log4j2.xml fi
3737
</Configuration>
3838
```
3939

40-
You can also override log level by setting `LOG_LEVEL` env var - Here is an example using AWS Serverless Application Model (SAM)
40+
You can also override log level by setting `POWERTOOLS_LOG_LEVEL` env var - Here is an example using AWS Serverless Application Model (SAM)
4141

4242
```yaml:title=template.yaml
4343
Resources:
@@ -48,7 +48,7 @@ Resources:
4848
Runtime: java8
4949
Environment:
5050
Variables:
51-
LOG_LEVEL: DEBUG # highlight-line
51+
POWERTOOLS_LOG_LEVEL: DEBUG # highlight-line
5252
```
5353

5454
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.

docs/content/index.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Environment variable | Description | Utility
123123
**POWERTOOLS_SERVICE_NAME** | Sets service name used for tracing namespace, metrics dimension and structured logging | All
124124
**POWERTOOLS_METRICS_NAMESPACE** | Sets namespace used for metrics | [Metrics](./core/metrics)
125125
**POWERTOOLS_LOGGER_SAMPLE_RATE** | Debug log sampling | [Logging](./core/logging)
126-
**LOG_LEVEL** | Sets logging level | [Logging](./core/logging)
126+
**POWERTOOLS_LOG_LEVEL** | Sets logging level | [Logging](./core/logging)
127127
**POWERTOOLS_TRACER_CAPTURE_RESPONSE** | Enables/Disables tracing mode to capture method response | [Tracing](./core/tracing)
128128
**POWERTOOLS_TRACER_CAPTURE_ERROR** | Enables/Disables tracing mode to capture method error | [Tracing](./core/tracing)
129129

example/template.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Resources:
2121
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
2222
Variables:
2323
POWERTOOLS_SERVICE_NAME: "Payment Service"
24-
LOG_LEVEL: INFO
24+
POWERTOOLS_LOG_LEVEL: INFO
2525
Tracing: Active
2626
Events:
2727
HelloWorld:

powertools-logging/src/main/java/software/amazon/lambda/powertools/logging/internal/LambdaLoggingAspect.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public final class LambdaLoggingAspect {
5656
private static final Logger LOG = LogManager.getLogger(LambdaLoggingAspect.class);
5757
private static final Random SAMPLER = new Random();
5858

59-
private static final String LOG_LEVEL = System.getenv("LOG_LEVEL");
59+
private static final String LOG_LEVEL = System.getenv("POWERTOOLS_LOG_LEVEL");
6060
private static final String SAMPLING_RATE = System.getenv("POWERTOOLS_LOGGER_SAMPLE_RATE");
6161

6262
private static Level LEVEL_AT_INITIALISATION;

0 commit comments

Comments
 (0)