'''Utility function for logging'''
import logging
import sys


def configure_logging(debug, silent=False):
    '''Sets the default logger and the boto logger to appropriate levels of chattiness.'''
    logger = logging.getLogger('')
    boto_logger = logging.getLogger('boto')
    botocore_logger = logging.getLogger('botocore')

    if silent and debug:
        raise Exception('Debug and silent logging options are mutually exclusive')

    if silent:
        logging.disable(logging.CRITICAL)
    elif debug:
        logger.setLevel(logging.DEBUG)
        boto_logger.setLevel(logging.INFO)
        botocore_logger.setLevel(logging.DEBUG)
    else:
        logger.setLevel(logging.INFO)
        boto_logger.setLevel(logging.CRITICAL)
        botocore_logger.setLevel(logging.CRITICAL)

    # If there are any handlers on the root logger, remove them so that if this function is called more
    # than once, we don't get the same statement logged multiple times.
    for handler in logger.handlers:
        logger.removeHandler(handler)

    stream_handler = logging.StreamHandler(sys.__stdout__)
    stream_handler.setLevel(logging.DEBUG)
    stream_handler.setFormatter(logging.Formatter('%(asctime)s %(name)s %(levelname)s %(message)s'))
    logger.addHandler(stream_handler)

@@ -43,16 +43,52 @@
 logging%0A
+import logging.handlers as handlers%0A
 import s
@@ -355,24 +355,275 @@
 botocore')%0A%0A
+    # If there are any handlers on the root logger, remove them so that if this function is called more%0A    # than once, we don't get the same statement logged multiple times.%0A    for handler in logger.handlers:%0A        logger.removeHandler(handler)%0A%0A
     if silen
@@ -930,69 +930,120 @@
     
-else:%0A        logger.setLevel(logging.INFO)%0A        boto_logg
+    file_handler = handlers.RotatingFileHandler('debug.log', maxBytes=1048576, backupCount=1)%0A        file_handl
 er.s
@@ -1054,32 +1054,29 @@
 vel(logging.
-CRITICAL
+DEBUG
 )%0A        bo
@@ -1077,300 +1077,381 @@
     
-botocore_logger.setLevel(logging.CRITICAL)%0A%0A    # If there are any handlers on the root logger, remove them so that if this function is called more%0A    # than once, we don't get the same statement logged multiple times.%0A    for handler in logger.handlers:%0A        logger.removeHandler(handler
+file_handler.setFormatter(logging.Formatter('%25(asctime)s %25(name)s %25(levelname)s %25(message)s'))%0A        logger.addHandler(file_handler)%0A        boto_logger.addHandler(file_handler)%0A        botocore_logger.addHandler(file_handler)%0A    else:%0A        logger.setLevel(logging.INFO)%0A        boto_logger.setLevel(logging.CRITICAL)%0A        botocore_logger.setLevel(logging.CRITICAL
 )%0A%0A 
@@ -1540,29 +1540,28 @@
 vel(logging.
-DEBUG
+INFO
 )%0A    stream

Add file handler for debug logs