[openstack-dev] [keystone] how to enable logging for unit tests

Clark Boylan clark.boylan at gmail.com
Fri Feb 28 22:04:20 UTC 2014


On Fri, Feb 28, 2014 at 1:30 PM, John Dennis <jdennis at redhat.com> wrote:
> I'd like to enable debug logging while running some specific unit tests
> and I've not been able to find the right combination of levers to pull
> to get logging output on the console.
>
> In keystone/etc/keystone.conf.sample (which is config file loaded for
> the unit tests) I've set debug to True, I've verified CONF.debug is true
> when the test executes. I've also tried setting log_file and log_dir to
> see if I could get logging written to a log file instead, but no luck.
>
> I have noticed when a test fails I'll see all the debug logging emitted
> inbetween
>
> {{{
> }}}
>
> which I think is something testtools is doing.
>
> This leads me to the theory testtools is somehow consuming the logging
> output. Is that correct?
>
> How do I get the debug logging to show up on the console during a test run?
>
> --
> John
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

I was going to respond to this and say it is easy, you set
OS_LOG_CAPTURE=False in your test env and rerun the tests. But it
doesn't look like keystone has made log capturing configurable [0]. I
thought we had set this variable properly in places but I have
apparently misremembered. You could add an OS_LOG_CAPTURE flag and set
it in .testr.conf and see if it helps. The other thing you can do is
refer to the subunit log file in .testrepository/$TEST_ID after tests
have run.

[0] https://git.openstack.org/cgit/openstack/keystone/tree/keystone/tests/core.py#n338

Clark



More information about the OpenStack-dev mailing list