python logging dictConfig custom formatter is not being called : <p>i have the following ColoeredFormatter in my Module.</p>

<p>But The Formatter does not get called. I expect "hi" on the console, but i get "This is an info of the root logger".</p>

<p>i've already deleted all .pyc files, but it did not help.</p>

<p><strong>MyModule/__init__.py</strong></p>

<pre><code>from MyModule.ColoredFormatter import ColoredFormatter

__all__ = ('ColoredFormatter')
</code></pre>

<p><strong>MyModule/ColoredFormatter.py</strong></p>

<pre><code>import logging

class ColoredFormatter(logging.Formatter):
    def __init__(self, default):
        self.default = default

    def format(self, record):
        print("hi")
        record.msg = "hi"
        return self.default.format(record)
</code></pre>

<p><strong>My Script</strong></p>

<pre><code>import logging, logging.config, yaml

conf="""
logging:
  version: 1
  disable_existing_loggers: true
  root:
    level: !!python/name:logging.NOTSET
    handlers: [console]
  handlers:
    console:
      class: logging.StreamHandler
      stream: ext://sys.stdout
      formatter: myFormatter
      level: !!python/name:logging.NOTSET

  formatters:
    myFormatter:
      class: !!python/name:MyModule.ColoredFormatter
"""
dict = yaml.parse(conf)
logging.config.dictConfig(dict["logging"])

logging.info("This is an info of the root logger")
</code></pre>
