capture text logged in integration tests to a file

Bug #1413805 reported by Wu Hong Guang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Invalid
Undecided
Wu Wenxiang

Bug Description

 the unittest2 runner replaces sys.stdout/sys.stderr before the testing starts, and the StreamHandler is still writing to the original sys.stdout.

To assign the 'current' sys.stdout to the handler

import sys
import unittest
import logging

logger = logging.getLogger()
logger.level = logging.DEBUG

class TestCase(unittest.TestCase):
    def Setup(self):
        //stream_handler = logging.StreamHandler(sys.stdout)
        self.handler = logging.StreamHandler(sys.stdout)
        logger.addHandler(stream_handler)

  def Teardown()
        logger.removeHandler(stream_handler)

Wu Hong Guang (whg)
tags: added: integration-tests
Changed in horizon:
assignee: nobody → Wu Wenxiang (wu-wenxiang)
Revision history for this message
Timur Sufiev (tsufiev-x) wrote :

Wu Hong, could you please elaborate the purpose of this change? For example here http://logs.openstack.org/35/168935/15/check/gate-horizon-dsvm-integration/5bd8a67/logs/apache/horizon_error.txt.gz I can see all Apache logs. What's wrong with them?

Timur Sufiev (tsufiev-x)
Changed in horizon:
status: New → Incomplete
Changed in horizon:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.