Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从导入的python文件捕获日志消息_Python_Logging - Fatal编程技术网

从导入的python文件捕获日志消息

从导入的python文件捕获日志消息,python,logging,Python,Logging,从导入的python文件获取日志信息 我正在构建一个基于python的测试套件。 使用_导入函数调用测试 我想在测试应用程序中捕获日志消息(在测试中)。日志消息是使用python日志模块生成的。 我该怎么做?例如,在psuedo代码中: for test in testList: # do something # Import Test testid = __import__(test)

从导入的python文件获取日志信息

我正在构建一个基于python的测试套件。 使用_导入函数调用测试 我想在测试应用程序中捕获日志消息(在测试中)。日志消息是使用python日志模块生成的。 我该怎么做?例如,在psuedo代码中:

    for test in testList:  

               # do something
             # Import Test   

             testid = __import__(test)  

             testOut = testid.run(parameter1,parameter2)    

             print "   => Result: %s\n" % testOut            
             # capture logging information from test which imports logging and append to wxpython window

您可以轻松创建自定义日志处理程序,并将其分配给模块使用的记录器


请参见

我已经阅读了文档,但不太清楚如何获取另一个python模块的日志o/p。没有每个模块的日志记录,只有每个日志记录。因此,只需获取模块正在使用的同一个记录器(
logging.getLogger(…)
),并对其进行相应的配置即可。这个问题似乎与wxpython无关。