diff --git a/docs/content/core/logging.mdx b/docs/content/core/logging.mdx index 6d6591f9d..4e6efba2a 100644 --- a/docs/content/core/logging.mdx +++ b/docs/content/core/logging.mdx @@ -37,7 +37,7 @@ Powertools extends the functionality of Log4J. Below is an example log4j2.xml fi ``` -You can also override log level by setting `LOG_LEVEL` env var - Here is an example using AWS Serverless Application Model (SAM) +You can also override log level by setting `POWERTOOLS_LOG_LEVEL` env var - Here is an example using AWS Serverless Application Model (SAM) ```yaml:title=template.yaml Resources: @@ -48,7 +48,7 @@ Resources: Runtime: java8 Environment: Variables: - LOG_LEVEL: DEBUG # highlight-line + POWERTOOLS_LOG_LEVEL: DEBUG # highlight-line ``` 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. diff --git a/docs/content/index.mdx b/docs/content/index.mdx index 80318f14b..02a49721b 100644 --- a/docs/content/index.mdx +++ b/docs/content/index.mdx @@ -123,7 +123,7 @@ Environment variable | Description | Utility **POWERTOOLS_SERVICE_NAME** | Sets service name used for tracing namespace, metrics dimension and structured logging | All **POWERTOOLS_METRICS_NAMESPACE** | Sets namespace used for metrics | [Metrics](./core/metrics) **POWERTOOLS_LOGGER_SAMPLE_RATE** | Debug log sampling | [Logging](./core/logging) -**LOG_LEVEL** | Sets logging level | [Logging](./core/logging) +**POWERTOOLS_LOG_LEVEL** | Sets logging level | [Logging](./core/logging) **POWERTOOLS_TRACER_CAPTURE_RESPONSE** | Enables/Disables tracing mode to capture method response | [Tracing](./core/tracing) **POWERTOOLS_TRACER_CAPTURE_ERROR** | Enables/Disables tracing mode to capture method error | [Tracing](./core/tracing) diff --git a/example/template.yaml b/example/template.yaml index 8ef57d12f..435f187cf 100644 --- a/example/template.yaml +++ b/example/template.yaml @@ -21,7 +21,7 @@ Resources: Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object Variables: POWERTOOLS_SERVICE_NAME: "Payment Service" - LOG_LEVEL: INFO + POWERTOOLS_LOG_LEVEL: INFO Tracing: Active Events: HelloWorld: diff --git a/powertools-logging/src/main/java/software/amazon/lambda/powertools/logging/internal/LambdaLoggingAspect.java b/powertools-logging/src/main/java/software/amazon/lambda/powertools/logging/internal/LambdaLoggingAspect.java index 4c9f48c82..492bfcc98 100644 --- a/powertools-logging/src/main/java/software/amazon/lambda/powertools/logging/internal/LambdaLoggingAspect.java +++ b/powertools-logging/src/main/java/software/amazon/lambda/powertools/logging/internal/LambdaLoggingAspect.java @@ -58,7 +58,7 @@ public final class LambdaLoggingAspect { private static final ObjectMapper MAPPER = new ObjectMapper(); private static final Random SAMPLER = new Random(); - private static final String LOG_LEVEL = System.getenv("LOG_LEVEL"); + private static final String LOG_LEVEL = System.getenv("POWERTOOLS_LOG_LEVEL"); private static final String SAMPLING_RATE = System.getenv("POWERTOOLS_LOGGER_SAMPLE_RATE"); private static Level LEVEL_AT_INITIALISATION;