vendredi 1 juillet 2016

Custom logger error?

I'm trying to learn how to create a custom logger. I'm not exactly sure what the below error is telling me, so if anyone could lead me in the right direction that would be great.

When I import and run the logger from my launcher.py file...

import custom_logging as logging
logging.getLogger(__name__)

I get this error:

No handlers could be found for logger "mb.custom-logger"

I know that the custom-logger part of the logger name is coming from within the custom_logger/__init__.py file....

... a bunch of code

log = getLogger('mb-logger')
log.warning('Creating log : {0}'.format(log_file))

But I'm not sure where the mb part comes from in the error message or what it relates to. Any thoughts?

Also to give some context, my project is set up like this:

Project_Root/
    bin/
        launcher.py (this is where the error is occurring)
    modules/
       custom-logger/
            source/
                custom_logger/
                    __init__.py (this is where the custom logger is created)

Aucun commentaire:

Enregistrer un commentaire