def init_rotating_logger(level, logfile, max_files, max_bytes):
logging.basicConfig()<EOL>root_logger = logging.getLogger()<EOL>log_format = "<STR_LIT>"<EOL>root_logger.setLevel(level)<EOL>handler = RotatingFileHandler(logfile, maxBytes=max_bytes, backupCount=max_files)<EOL>handler.setFormatter(logging.Formatter(fmt=log_format, datefmt=date_format))<EOL>root_logger.addHandler(handler)<EOL>for handler in root_logger.handlers:<EOL><INDENT>root_logger.debug("<STR_LIT>" + str(handler))<EOL>if isinstance(handler, logging.StreamHandler):<EOL><INDENT>root_logger.debug("<STR_LIT>" + str(handler))<EOL>root_logger.handlers.remove(handler)<EOL><DEDENT><DEDENT>
Initializes a rotating logger

    It also makes sure that any StreamHandler is removed, so as to avoid stdout/stderr
    constipation issues