AOSSIE-Org / AOSSIE-Org/PictoPy

Logging: InterceptHandler preserves exc_info and stack_info (should be cleared before formatting)

未關閉
#708 0 則留言 0 個 reaction 已指派 1 人 已被 @VasuS609 認領 在 GitHub 檢視
backend bug
主要語言
Python
星號
283
分支
679
平均合併
7 天 2 小時
30 天內合併 PR
3

描述

### Is there an existing issue for this?

- [x] I have searched the existing issues

### What happened?

The InterceptHandler in backend/app/logging/setup_logging.py calls
self.format(record) while record.exc_info and record.stack_info are still set.

Python’s Formatter.format() automatically appends traceback and stack output if
these fields are truthy.

This violates the project rule that exc_info and stack_info should not be
preserved when rerouting logs.

Fix proposal:
record.exc_info = None
record.stack_info = None
msg = self.format(record)

This should be applied around lines 238–252.

### Record

- [x] I agree to follow this project's Code of Conduct

### Checklist before Submitting

- [x] Have you updated docs for it?
- [ ] Have you added unit tests?
- [x] Have you made sure unit tests pass?
- [x] Have you made sure code formatting is correct?
- [x] Do Your changes passes all tests?

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。