Menu
AWS SDK for C++
Developer Guide

Logging

The AWS SDK for C++ includes logging support that you can configure. When initializing the logging system, you can control the filter level and the logging target (file with a name that has a configurable prefix or a stream). The log file generated by the prefix option rolls over once per hour to allow for archiving or deleting log files.

Copy
Aws::Utils::Logging::InitializeAWSLogging( Aws::MakeShared<Aws::Utils::Logging::DefaultLogSystem>( "RunUnitTests", Aws::Utils::Logging::LogLevel::Trace, "aws_sdk_"));

If you don't call InitializeAWSLogging in your program, the SDK will not do any logging. If you do use logging, don't forget to shut it down at the end of your program by calling ShutdownAWSLogging:

Copy
Aws::Utils::Logging::ShutdownAWSLogging();

Example integration test with logging

Copy
#include <aws/external/gtest.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/core/utils/logging/DefaultLogSystem.h> #include <aws/core/utils/logging/AWSLogging.h> #include <iostream> int main(int argc, char** argv) { Aws::Utils::Logging::InitializeAWSLogging( Aws::MakeShared<Aws::Utils::Logging::DefaultLogSystem>( "RunUnitTests", Aws::Utils::Logging::LogLevel::Trace, "aws_sdk_")); ::testing::InitGoogleTest(&argc, argv); int exitCode = RUN_ALL_TESTS(); Aws::Utils::Logging::ShutdownAWSLogging(); return exitCode; }