Skip to content

Document log level configuration for MinimalLambda and logging providers #367

Description

@j-d-ha

Problem

MinimalLambda log-level behavior is unclear in deployed Lambda functions, especially when combining:

  • MinimalLambda default logging (LambdaApplication.CreateBuilder())
  • Microsoft.Extensions.Logging configuration
  • AWS Lambda runtime support / ILambdaLogger
  • Lambda Advanced Logging Controls (loggingFormat: JSON, application/system log levels)
  • third-party providers such as AWS Lambda Powertools for .NET

In a consumer app, setting AWS_LAMBDA_HANDLER_LOG_LEVEL=Warning did not suppress information logs as expected. Earlier attempts with Logging__LogLevel__Default=Warning and POWERTOOLS_LOG_LEVEL=Warning were also unclear because they affect different layers/providers.

Current code path observed

MinimalLambda default builder adds logging here:

Services.AddLogging(logging =>
{
    logging.AddConfiguration(Configuration.GetSection("Logging"));
    logging.AddSimpleConsole();

    logging.Configure(options =>
    {
        options.ActivityTrackingOptions = ActivityTrackingOptions.SpanId
                                          | ActivityTrackingOptions.TraceId
                                          | ActivityTrackingOptions.ParentId;
    });
});

So standard .NET configuration like this appears relevant for ILogger filtering:

Logging__LogLevel__Default=Warning

MinimalLambda also uses Amazon.Lambda.RuntimeSupport / LambdaBootstrap, so AWS runtime settings may be relevant for ILambdaLogger, e.g.:

AWS_LAMBDA_HANDLER_LOG_LEVEL=Warning

For Lambda Advanced Logging Controls with custom runtimes, AWS docs mention runtime-facing variables:

AWS_LAMBDA_LOG_LEVEL
AWS_LAMBDA_LOG_FORMAT

Powertools for AWS Lambda (.NET) has its own provider setting:

POWERTOOLS_LOG_LEVEL=Warning

Requested docs / clarification

Please document how log-level configuration flows through MinimalLambda, including:

  1. Which settings affect ILogger<T> created through MinimalLambda defaults.
  2. Which settings affect ILambdaLogger / context.Logger.
  3. Whether AWS_LAMBDA_HANDLER_LOG_LEVEL applies to MinimalLambda custom-runtime apps, or only managed .NET runtimes / specific logging paths.
  4. How Lambda Advanced Logging Controls interact with MinimalLambda (loggingFormat: JSON, ApplicationLogLevel, SystemLogLevel, AWS_LAMBDA_LOG_LEVEL, AWS_LAMBDA_LOG_FORMAT).
  5. How third-party logging providers such as AWS Lambda Powertools fit in, and whether users should set provider-specific variables (POWERTOOLS_LOG_LEVEL) in addition to or instead of standard .NET logging config.
  6. Recommended CDK examples for common cases:
    • MinimalLambda default logging only
    • MinimalLambda + Powertools
    • Lambda service-side filtering via Advanced Logging Controls

Helpful expected outcome

A docs section/table like:

Logging path API used Config key/env var Value format Notes
Default ILogger ILogger<T> Logging__LogLevel__Default Warning Standard Microsoft.Extensions.Logging
AWS Lambda logger ILambdaLogger AWS_LAMBDA_HANDLER_LOG_LEVEL or other Warning? Clarify applicability
Lambda ALC Lambda service filter CDK applicationLogLevel / AWS_LAMBDA_LOG_LEVEL WARN Service-side filtering
Powertools Powertools provider POWERTOOLS_LOG_LEVEL Warning Provider-specific

Goal: make deployed log-level behavior predictable and avoid trial-and-error across runtime/provider/service filtering layers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions