html - 日志未填充在 PyCharm(pytest 框架)中生成的 HTML 报告中
问题描述
我已生成 HTML 报告,但在日志文件中捕获的日志未显示在 HTML 报告中。它始终显示为未捕获日志。
下面是我使用的代码:
import logging
class LogGen:
@staticmethod
def loggen():
for handler in logging.root.handlers[:]:
logging.root.removeHandler(handler)
logging.basicConfig(filename="./Logs/automation.log",
format='%(asctime)s: %(levelname)s: %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p')
logger = logging.getLogger()
logger.setLevel(logging.INFO)
return logger
这是结果的图像。
解决方案
推荐阅读
- php - 范围日期时间(表单)的 Symfony 问题
- aem - Scene7 在 AEM 中基于时间发布
- c# - 使用租户选择页面扩展身份服务器登录流程,如何在该页面上获取用户声明?
- react-native - 'Chalet' 系列字体在 React Native iOS 应用程序中不起作用
- php - Wordpress 多站点子页面仅在第一次重定向到主页
- c# - 无法从与 slack 集成的机器人发送邮件
- prolog - 在序言中将分钟转换为小时
- javascript - 有没有办法在父类中获取子类文件路径?
- javascript - WebGL 2D Canvas Point 转换为 3D 世界点
- swift - 如何在swift4中更改特定annotationView的markerTintColor