advanced logging this file can be loaded into python application using the pyyaml module this provides yaml parser that can load yaml file as dictionary structure that can be passed to the logging config dictconfig(function as this is file it must be opened and closed to ensure that the resource is handled appropriatelyit is therefore best managed using the with-as statement as shown belowwith open('logging config yaml' 'as fconfig yaml safe_load( read()logging config dictconfig(configthis will open the yaml file in read-only mode and close it when the two statements have been executed this snippet is used in the following application that loads the logger configuration from the yaml fileimport logging import logging config import yaml with open('logging config yaml'' 'as fconfig yaml safe_load( read()logging config dictconfig(configlogger logging getlogger('mylogger''applicationcode def do_something()logger debug('debug message'logger info('info message'logger warning('warn message'logger error('error message'logger critical('critical message'logger info('starting'do_something(logger info('done'