[ckan-dev] Logging in commands question

David Read david.read at okfn.org
Wed Apr 6 16:24:07 UTC 2011


In cli.py there are a couple of calls to logging, such as this:

        logging.basicConfig()

but since they're not in CkanCommand, I don't think any of these will
affect your cli. So I'd expect the logging settings will come from
your development.ini (or a pylons config file you specify in the
paster command). So make sure you have your [logger] has handler =
console. Do send us your logging config if you're not sure.

David

2011/4/6 Adrià Mercader <amercadero at gmail.com>:
>> 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