Status: New
Owner: ----
Labels: Type-Enhancement Priority-Medium

New issue 1649 by [email protected]: logging is not effective as expecting when it is used by threading program
http://code.google.com/p/robotframework/issues/detail?id=1649

For the parallel process keyword was removed,so I want to do the parallel process test by python multi-thead.

I wrote the test python class as test keyword. I find that the 'logging' in thread does not write the log in log.html very well as it does in the main process,but the 'print' can do that both of the thread and the main process.

I hope to use logging to write logs but print, so does anyone has good ideas to solve my problem.

Attachment is my test files and run result.


*** Settings ***
Library           MultiThread.py

*** Test Cases ***
test
    multiLog    ${3}


import threading
import logging

class MultiThread:
    def func(self,times):
        logging.warn("logging in thead,times of %d"%times)
        print "print in thead,times of %d"%times

    def multiLog(self,times):
        logging.warn("loging in the main process %d"%times)
        threadObj = []
        for i in range(times):
            t = threading.Thread(target=self.func,args=(i,))
            threadObj.append(t)

        for tObj in threadObj:
            tObj.start()
            tObj.join()

if __name__ == '__main__':
    testObj = MultiThread()
    testObj.multiLog(3)

log.html
KEYWORD: MultiThread.Multi Log ${3} Expand All ΒΆ
Start / End / Elapsed: 20140204 21:18:02.075 / 20140204 21:18:02.077 / 00:00:00.002
21:18:02.076    WARN    loging in the main process 3
21:18:02.077    INFO    print in thead,times of 0
                        print in thead,times of 1
                        print in thead,times of 2

Attachments:
        test.rar  120 KB

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--

--- You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to