Skip to content

Conversation

@nsteffens
Copy link

Description of changes:

This adds documentation for the logging configuration options of a function that's added through Amplify.

Related GitHub issue #, if available:

aws-amplify/amplify-backend#2965

Instructions

If this PR should not be merged upon approval for any reason, please submit as a DRAFT

Which product(s) are affected by this PR (if applicable)?

  • amplify-cli
  • amplify-ui
  • amplify-studio
  • amplify-hosting
  • amplify-libraries

Which platform(s) are affected by this PR (if applicable)?

  • JS
  • Swift
  • Android
  • Flutter
  • React Native

Please add the product(s)/platform(s) affected to the PR title

Checks

  • Does this PR conform to the styleguide?

  • Does this PR include filetypes other than markdown or images? Please add or update unit tests accordingly.

  • Are any files being deleted with this PR? If so, have the needed redirects been created?

  • Are all links in MDX files using the MDX link syntax rather than HTML link syntax?

    ref: MDX: [link](https://docs.amplify.aws/)
    HTML: <a href="https://docs.amplify.aws/">link</a>

When this PR is ready to merge, please check the box below

  • Ready to merge

This shall be merged in sync with aws-amplify/amplify-backend#2965.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

ShadowCat567 pushed a commit to aws-amplify/amplify-backend that referenced this pull request Jan 5, 2026
…perties (#2968)

## Problem

<!--
Describe the issue this PR is solving
-->

**Issue number, if available:** #2965

## Changes

- Refactored `logging_options_parser.ts` to use modern, non-deprecated
AWS CDK properties for Lambda logging
- Replaced the deprecated `logRetention` property with a dedicated
`LogGroup` resource
- Updated `applicationLogLevelV2` and `loggingFormat` usage to follow
AWS CDK best practices
- Updated tests to verify the new implementation works correctly
- Maintained backward compatibility for end users (no API changes)

- Updated documentation to have logging field documented in general. See
PR aws-amplify/docs#8428

### Why

AWS CDK marked several properties in `NodejsFunction` as deprecated:
-
[`logRetention`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda_nodejs.NodejsFunction.html#logretentionspan-classapi-icon-api-icon-deprecated-titlethis-api-element-is-deprecated-its-use-is-not-recommended%EF%B8%8Fspan)
- Recommended to use a dedicated `LogGroup` resource
- Creating a `LogGroup` automatically to be used if logRetention is set.
Will fallback to default `NodeJsFunction` when `undefined`.

This change ensures that Lambda functions continue to work properly with
future AWS CDK versions.

## Testing

- Updated and extended unit tests to verify the new implementation
- Manually verified that logs are correctly configured with the proper
retention settings
- Ensured backward compatibility for user-facing APIs

**Corresponding docs PR, if applicable:** TBD

## Validation

Have ran tests locally. Should be tested against an AWS account before
going live.

## Checklist

- [x] If this PR includes a functional change to the runtime behavior of
the code, I have added or updated automated test coverage for this
change.
- [x] If this PR requires a change to the [Project Architecture
README](../PROJECT_ARCHITECTURE.md), I have included that update in this
PR.
- [x] If this PR requires a docs update, I have linked to that docs PR
above.
- [ ] If this PR modifies E2E tests, makes changes to resource
provisioning, or makes SDK calls, I have run the PR checks with the
`run-e2e` label set.

_By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license._

---------

Co-authored-by: Nico Steffens <nico.steffens@mercedes-benz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant