已合并
[bugfix]修复超长日志打印错误 #247
流栎创建于 18 天前
[bugfix]修复超长日志打印错误 #247
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 流栎 的贡献)atomgit-bot
18 天前 评论:
18 天前 评论:
变更摘要
本次变更修复了 Log::Printf 函数中针对超长日志的处理逻辑错误。原先当日志长度超过限制时,仅打印一条截断提示信息,且该提示使用了原始日志级别(lv)而非告警级别,同时被截断的日志内容本身并未输出。修改后,超长日志内容会被正确截断并打印,随后以 LogLv::WARN 级别输出截断告警提示,确保日志信息不丢失且告警语义明确。
主要改动
- 超长日志内容现在会被打印:新增
fprintf(fp_, "%s\n", msg),确保被截断的日志内容在截断提示之前输出,避免原先仅打印告警而丢失日志信息的问题。 - 截断字符串正确终止:新增
msg[MAX_PRINT - 1] = '\0',显式确保截断后的msg缓冲区以空字符结尾,防止fprintf读取越界。 - 截断提示使用正确的告警级别:将
AddPrefixInfo的日志级别参数从原始的lv改为LogLv::WARN,使截断告警始终以 WARN 级别输出,而非跟随原始日志的级别。


atomgit-bot
18 天前 评论:
18 天前 评论:
18 天前 添加了label:ascend-cla/yes
ascend-robot
18 天前 评论:
18 天前 评论:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-Ascend/msopprof | ✅ 门飞飞, zsz_wlf (2/2) | ✅ 门飞飞 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
zzzsss1234, thanks for your pull request. All authors of the commits have signed the CLA. 👍


流栎
18 天前 评论:
18 天前 评论:
compile


18 天前 添加了label:ci-pipeline-running
ascend-robot
18 天前 评论:
18 天前 评论:
ascend docs pipeline is running...


18 天前 添加了label:docs-ci-pipeline-running
ascend-robot
18 天前 评论:
18 天前 评论:
ascend docs pipeline is running...


ascend-robot
18 天前 评论:
18 天前 评论:
✅ 跳过 docs ci 检查,没有需要检查的文档文件


18 天前 删除了label:docs-ci-pipeline-running
18 天前 添加了label:docs-ci-pipeline-success
ascend-robot
18 天前 评论:
18 天前 评论:
✅ 跳过 docs ci 检查,没有需要检查的文档文件


18 天前 删除了label:ci-pipeline-running
18 天前 添加了label:ci-pipeline-passed
AtlasAccount
18 天前 评论:
18 天前 评论:
流水线 PR-pipeline_msopprof#533 [ commitID:793cdee5 ] 已完成
>>>代码风格自动修复执行成功(无修复内容)
| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_msopprof_x86 | ✅ | >>> |
| Build_msopprof_arm | ✅ | >>> | |
| 恶意代码检查 | Antipoison_msopprof | ✅ | >>> |
| 编码安全与规范检查 | codecheck_pre-commit | ✅ | >>> |
| pre-commit | ✅ | >>> | |
| 开源片段检查 | SCA_msopprof | ✅ | >>> |
| 开发者测试 | UT_msopprof_x86 | ✅ | >>> |
| 流水线 | PR-pipeline_msopprof | ✅ | >>> |
- compile : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


17 天前 修改了pull request 的描述
17 天前 关联了issue:[Bug]: 采集catlass算子,算子名太长导致数据截断未打印Operator Basic Information信息,[INFO] Log length reach limit, message truncated日志级别不正确
17 天前 关联了issue:[Bug]: 采集catlass算子,算子名太长导致数据截断未打印Operator Basic Information信息,[INFO] Log length reach limit, message truncated日志级别不正确
17 天前 关联了里程碑:MindStudio 26.2.0
zhaishangzhao
17 天前 评论:
17 天前 评论:
/lgtm


went_code
17 天前 评论:
17 天前 评论:
/approve


17 天前 添加了label:approvedlgtm
17 天前 合入了pull request
1. 修改描述
当前日志打印逻辑错误,针对超长日志仅仅打印告警信息,没有warn告警,对日志也没有做截断处理
修改逻辑,超长日志是正确打印信息,且有相应的warn告警提示
csrc/utils/cpputils/log.h
2. 功能验证
INFO] Profiling running finished. All task success.
[INFO] Start analyze kernel on device: device0, kernel: _ZN7Catlass13KernelAdapterINS_4Gemm6Kernel13W4A8MatmulMSDINS1_5Block9Blo_3414736449211411322, name is: 0
[INFO] Save profiling data with metric [PipeUtilization] success.
[INFO] Save profiling data with metric [ArithmeticUtilization] success.
[INFO] Save profiling data with metric [L2Cache] success.
[INFO] Save profiling data with metric [Memory] success.
[INFO] Save profiling data with metric [ResourceConflictRatio] success.
[INFO] Save profiling data with metric [MemoryL0] success.
[INFO] Save profiling data with metric [MemoryUB] success.
[INFO] Performance Summary Report:
[INFO] Operator Basic Information:
[WARN] Log length reach limit, message truncated
[INFO] Profiling results saved in /home/zl/catlass-AML/output/bin/OPPROF_20260807024216_GYFLKIVUITHRZQNB
[INFO] Profiling data parse finished.
[INFO] Op profiling finish. Welcome to next use.
3. 代码检视
4. 资料修改自检