Page updated Nov 11, 2023

Use AWS SDK for logging

For advanced use cases where Amplify does not provide the functionality, you can retrieve the escape hatch to access the underlying Amazon CloudWatch client.

Note: While the Amplify Library for Kotlin is production ready, please note that the underlying AWS SDK for Kotlin is currently in Developer Preview, and is not yet intended for production workloads. Here is additional reading material on the stability of the SDK

The escape hatch provides access to the underlying CloudWatchLogsClient instance. Then retrieve the escape hatch with this code:

Gradle Imports

implementation "aws.sdk.kotlin:cloudwatchlogs:KOTLIN_SDK_VERSION"
1implementation "aws.sdk.kotlin:cloudwatchlogs:KOTLIN_SDK_VERSION"
AWSCloudWatchLoggingPlugin plugin = (AWSCloudWatchLoggingPlugin)Amplify.Logging.getPlugin("awsCloudWatchLoggingPlugin"); CloudWatchLogsClient client = plugin.getEscapeHatch();
1AWSCloudWatchLoggingPlugin plugin = (AWSCloudWatchLoggingPlugin)Amplify.Logging.getPlugin("awsCloudWatchLoggingPlugin");
2CloudWatchLogsClient client = plugin.getEscapeHatch();