Which module should contain logging.config.dictConfig(my_dictionary)? What about my_dictionary?
Question: This is all Python. I am still learning...

I have written two modules for my Python application: `Module1` and `Module2`.
I need to send my logging results to three different files. `Module1` sends to
`setup.log` and `setupdetails.log` files and `Module2` sends to `runall.log`
Module2 is the application I run. Within it is an import statement that calls
Module1.

Because I have configured my logging in a `my_dictionary`, which one of the
modules should contain the dictionary? Which one of the modules should contain
the `logging.config.dictConfig(my_dictionary)` function?

Do you know of anywhere I could find a good script with an example of how to
use `dictConfig`?


Answer: So, I just finally figured it out.

It all works well if one puts the dictionary in the child module `Module 1`
(and set `Propagate: True`).

    
    
    MY_DICTIONARY = {
    'version': 1,              
    'disable_existing_loggers': False,
    'formatters': {
        'verbose': {
            'format': '%(levelname)-8s %(asctime)s %(module)s %(process)d %(thread)d %(message)s',
            'datefmt': '%a, %d %b %Y %H:%M:%S'
    
        },
        'standard': {
            'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s',
            'datefmt': '%a, %d %b %Y %H:%M:%S'
    
        },
        'simple': {
            'format': '%(asctime)s %(levelname)-8s %(message)s',
            'datefmt': '%a, %d %b %Y %H:%M:%S'
        }
    #etc.
    }
    

}

Followed by the following calls:

    
    
    logging.config.dictConfig(MY_DICTIONARY)
    vmrunalllogger = logging.getLogger('VMRunAll_Python_Logger')
    

Then in Module 2 (the parent module), have this:

    
    
    logging.config.dictConfig(MY_DICTIONARY)
    mylogger = logging.getLogger('RunAll_Logger')
    

I could not find specific examples that showed two different modules logging
to multiple files like mine is doing, but information from multiple sources
like the following helped:

  1. [From the Python documentation](http://docs.python.org/2/library/logging.config.html)
  2. [Another question on Stackoverflow.com](http://stackoverflow.com/questions/10931423/using-dictconfig-in-python-logging-need-to-create-a-logger-with-a-different-fil)
  3. [And the examples of in the cookbook](http://docs.python.org/2/howto/logging-cookbook.html)

