(fname, defaults=None, disable_existing_loggers=True, encoding=None)
Read the logging configuration from a ConfigParser-format file.

    This can be called several times from an application, allowing an end user
    the ability to select from various pre-canned configurations (if the
    developer provides a mechanism to present the choices and load the chosen
    configuration).
Read the logging configuration from a ConfigParser-format file.
Read the logging configuration from a ConfigParser - format file .
def fileConfig(fname, defaults=None, disable_existing_loggers=True, encoding=None):
    """
    Read the logging configuration from a ConfigParser-format file.

    This can be called several times from an application, allowing an end user
    the ability to select from various pre-canned configurations (if the
    developer provides a mechanism to present the choices and load the chosen
    configuration).
    """
    import configparser

    if isinstance(fname, configparser.RawConfigParser):
        cp = fname
    else:
        cp = configparser.ConfigParser(defaults)
        if hasattr(fname, 'readline'):
            cp.read_file(fname)
        else:
            encoding = io.text_encoding(encoding)
            cp.read(fname, encoding=encoding)

    formatters = _create_formatters(cp)

    # critical section
    logging._acquireLock()
    try:
        _clearExistingHandlers()

        # Handlers add themselves to logging._handlers
        handlers = _install_handlers(cp, formatters)
        _install_loggers(cp, handlers, disable_existing_loggers)
    finally:
        logging._releaseLock()
def fileConfig ( fname , defaults = None , disable_existing_loggers = True , encoding = None ) : import configparser if isinstance ( fname , configparser . RawConfigParser ) : cp = fname else : cp = configparser . ConfigParser ( defaults ) if hasattr ( fname , 'readline' ) : cp . read_file ( fname ) else : encoding = io . text_encoding ( encoding ) cp . read ( fname , encoding = encoding ) formatters = _create_formatters ( cp ) # critical section logging . _acquireLock ( ) try : _clearExistingHandlers ( ) # Handlers add themselves to logging._handlers handlers = _install_handlers ( cp , formatters ) _install_loggers ( cp , handlers , disable_existing_loggers ) finally : logging . _releaseLock ( )