Skip to content

Commit 67956ae

Browse files
authored
fix: log timeRotating (#539)
## Description <!-- Please include a summary of the changes below; Fill in the issue number that this PR addresses (if applicable); Fill in the related MemOS-Docs repository issue or PR link (if applicable); Mention the person who will review this PR (if you know who it is); Replace (summary), (issue), (docs-issue-or-pr-link), and (reviewer) with the appropriate information. 请在下方填写更改的摘要; 填写此 PR 解决的问题编号(如果适用); 填写相关的 MemOS-Docs 仓库 issue 或 PR 链接(如果适用); 提及将审查此 PR 的人(如果您知道是谁); 替换 (summary)、(issue)、(docs-issue-or-pr-link) 和 (reviewer) 为适当的信息。 --> Summary: (summary) Fix: #(issue) Docs Issue/PR: (docs-issue-or-pr-link) Reviewer: @(reviewer) ## Checklist: - [ ] I have performed a self-review of my own code | 我已自行检查了自己的代码 - [ ] I have commented my code in hard-to-understand areas | 我已在难以理解的地方对代码进行了注释 - [ ] I have added tests that prove my fix is effective or that my feature works | 我已添加测试以证明我的修复有效或功能正常 - [ ] I have created related documentation issue/PR in [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) (if applicable) | 我已在 [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) 中创建了相关的文档 issue/PR(如果适用) - [ ] I have linked the issue to this PR (if applicable) | 我已将 issue 链接到此 PR(如果适用) - [ ] I have mentioned the person who will review this PR | 我已提及将审查此 PR 的人
2 parents 5d434ea + 67015e5 commit 67956ae

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

docker/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ click==8.2.1
1515
cobble==0.1.4
1616
colorama==0.4.6
1717
coloredlogs==15.0.1
18+
concurrent-log-handler==0.9.28
1819
cryptography==45.0.5
1920
cyclopts==3.22.2
2021
defusedxml==0.7.1

poetry.lock

Lines changed: 21 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ dependencies = [
4646
"scikit-learn (>=1.7.0,<2.0.0)", # Machine learning
4747
"fastmcp (>=2.10.5,<3.0.0)",
4848
"python-dateutil (>=2.9.0.post0,<3.0.0)",
49+
"concurrent-log-handler (>=0.9.28,<1.0.0)", # Process-safe rotating file handler
4950
]
5051

5152
[project.urls]

src/memos/log.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def filter(self, record):
5353
record.user_name = get_current_user_name()
5454
record.api_path = get_current_api_path()
5555
except Exception:
56+
record.api_path = "unknown"
5657
record.trace_id = "trace-id"
5758
record.env = "prod"
5859
record.user_type = "normal"
@@ -196,7 +197,7 @@ def close(self):
196197
},
197198
"file": {
198199
"level": "DEBUG",
199-
"class": "logging.handlers.TimedRotatingFileHandler",
200+
"class": "concurrent_log_handler.ConcurrentTimedRotatingFileHandler",
200201
"when": "midnight",
201202
"interval": 1,
202203
"backupCount": 3,

0 commit comments

Comments
 (0)