botocore icon indicating copy to clipboard operation
botocore copied to clipboard

botocore.credentials should log "Found credentials" consistently

Open kojiromike opened this issue 4 years ago • 4 comments

As I've been trying to debug an issue with an instance metadata credentials error, I looked at bumping the loglevel of botocore.credentials. That's when I noticed that most concrete CredentialProvider implementations log a message saying where credentials were found.

logger.info("Found credentials in environment variables")
logger.info('Found credentials in AWS_CREDENTIAL_FILE.')
logger.info("Found credentials in shared credentials file: %s", self._creds_filename)
logger.info("Credentials found in config file: %s", self._config_filename)
logger.info("Found credentials in boto config file: %s", filename)

However, InstanceMetadataProvider logs at the debug level. AssumeRoleProvider, AssumeRoleWithWebIdentityProvider, ContainerProvider and ProcessProvider don't log at all. (or if they do, it's not clear from reading the code -- I didn't actually trigger every provider to make this report.)

In my opinion, this logging should be consistent across credential providers, so that it's clear where credentials are actually coming from.

kojiromike avatar Oct 08 '19 20:10 kojiromike

@kojiromike - Thank you for your post. This seems like a reasonable idea to me. I would mark this as enhancement.

swetashre avatar Oct 09 '19 20:10 swetashre

I stumbled here looking for the source of a log message "Found credentials in environment variables" , now it is clear it was probably from boto module.

diepes avatar Mar 02 '21 03:03 diepes

Please, please move them to debug level. It's the only log line that my project logs that doesn't come from it :sweat_smile:

lancerinf avatar Oct 11 '22 19:10 lancerinf

Until Fixed

import boto3
import logging

boto3.set_stream_logger(name='botocore.credentials', level=logging.ERROR)

jacobjoy24 avatar Mar 10 '23 10:03 jacobjoy24