Нашел решение и поделился с другими:
Используя этот исходный код:
Log = logging.getLogger('myLogger')
level = logging.getLevelName('INFO')
Log.setLevel(level)
Я установил в своем файле settings.ini уровень журнала I хочу:
[Logging]
log_level = DEBUG
и изменить код:
# Read settings.ini file
config = configparser.ConfigParser()
config.read(dir_path + "/settings.ini")
# Logging
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
log_level = config.get("Logging", "log_level")
def setup_logger(name, log_file, level_name = 'INFO'):
# To setup as many loggers as you want
handler = logging.FileHandler(log_file)
handler.setFormatter(formatter)
logger = logging.getLogger(name)
level = logging.getLevelName(level_name)
logger.setLevel(level)
logger.addHandler(handler)
return logger
# Application Log:
app_log = setup_logger("app", "app.log", log_level)
# Usage Log:
usage_log = setup_logger("usage", "usage.log", log_level)