[ckan-dev] Logging in commands question

Adrià Mercader amercadero at gmail.com
Wed Apr 6 16:10:07 UTC 2011


> Anyway, this is rather by the by - perhaps we shouldn't do too much
> hypothesizing when we don't know what Adria is trying to achieve.

Sorry if I didn't explain myself, it's a pretty simple case:

>From an extension command (that is, that extends CkanCommand), I'm
calling methods from other modules.
These modules perform log calls, from loggers created the way David mentioned:
log = __import__("logging").getLogger(__name__)

def func()
    log.info("I'm in another module")

I just want to see these log messages in the console when executing
the command, and I found that depending on the scope of the imports,
as described in my first post, the messages are shown or not.




More information about the ckan-dev mailing list