The AWS SDK for Go has logging facilities available that allow
your application to enable debugging information for debugging and
diagnosing request issues or failures. The
Logger
Logger
When constructing an
ConfigLogger
is configured to send log
messages to the process' standard error (stderr). A custom logger
that satisfies the
LoggerLoadDefaultConfig
by wrapping it with
config.WithLogger
For example, to configure our clients to use our
applicationLogger
:
cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithLogger(applicationLogger))
Now clients configured using the constructed
aws.Config
will send log messages to
applicationLogger
.
Context-Aware Loggers
A Logger implementation may implement the optional
ContextLoggerWithContext
methods invoked with the current
context. This allows your logging implementations to return a
new Logger
that can write additional logging
metadata based on values present in the context.
ClientLogMode
By default, service clients do not produce log messages. To
configure clients to send log messages for debugging purposes, use
the
ClientLogModeConfig
.
ClientLogMode
can be set to enable debugging
messaging for:
-
Signature Version 4 (SigV4) Signing
-
Request Retries
-
HTTP Requests
-
HTTP Responses
For example, to enable logging of HTTP requests and retries:
cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithClientLogMode(aws.LogRetries | aws.LogRequest))
See
ClientLogMode