This answer is for those who're using logging.config.dictConfig
.
It is recommended to disable DEBUG and INFO messages from all external packages, not limited to botocore
and boto3
:
LOGGING_CONFIG = { # Add your preexisting logging config here.
"loggers": { # Add your preexisting loggers here.
"": {"level": "WARNING", "handlers": ["console"], "propagate": False}, # Root logger.
}
Alternatively, to disable debug messages from botocore
and boto3
but not from all external packages:
LOGGING_CONFIG = { # Add your preexisting config here too.
"loggers": { # Add your preexisting loggers here too.
"botocore": {"level": "WARNING", "handlers": ["console"], "propagate": False},
"boto3": {"level": "WARNING", "handlers": ["console"], "propagate": False},
}
Assuming your logging configuration dict is named LOGGING
, run this next:
logging.config.dictConfig(LOGGING)
The above must be run before boto3 is imported, irrespective of whether it is imported directly or indirectly! It won't entirely work if it's run after boto3 is already imported. You can choose to replace "WARNING"
above with "INFO"
or "ERROR"
or "CRITICAL"
.