def get_logger_for_python_runner_action(action_name, log_level="debug"):
    """
    Set up a logger which logs all the messages with level DEBUG and above to stderr.
    """
    logger_name = "actions.python.%s" % (action_name)

    if logger_name not in LOGGERS:
        level_name = log_level.upper()
        log_level_constant = getattr(stdlib_logging, level_name, stdlib_logging.DEBUG)
        logger = logging.getLogger(logger_name)

        console = stdlib_logging.StreamHandler()
        console.setLevel(log_level_constant)

        formatter = stdlib_logging.Formatter("%(name)-12s: %(levelname)-8s %(message)s")
        console.setFormatter(formatter)
        logger.addHandler(console)
        logger.setLevel(log_level_constant)

        LOGGERS[logger_name] = logger
    else:
        logger = LOGGERS[logger_name]

    return logger

    Set up a logger which logs all the messages with level DEBUG and above to stderr.
    
st2common/st2common/runners/utils.py