I have a Bar class which is a subclass of Foo
The Foo class contains the following
from game.utils import *
Here is game.utils
import logging logger = logging.getLogger('myapp') logger.setLevel(logging.WARNING) # create stream handler stream_handler = logging.StreamHandler() # create formatter formatter = logging.Formatter('%(levelname)s - %(module)s - %(message)s') # add formatter to stream handler stream_handler.setFormatter(formatter) # add stream_handler to logger logger.addHandler(stream_handler)
Instance of the Foo class are logging correctly using the correct module name. However, when I create an instance of the Bar class, they are also logging using Foo’s module name. Is there something I can do to have those instances log using the module name of ‘bar’ rather than ‘foo’?