elastic / elastic/ecs-logging-python
Disable `ensure_ascii` on `json.dumps`
- 主要语言
- Python
- 星标
- 74
- 派生
- 33
- 平均合并
- 9 小时 3 分钟
- 30 天内合并 PR
- 1
描述
Current output is unreadable in console if any language other than English is used in the messages.
Reproduction code:
```python
import logging
import ecs_logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
handler.setFormatter(ecs_logging.StdlibFormatter())
logger.addHandler(handler)
logger.info("안녕하세요")
```
Expected output:
```json
{
"@timestamp": "2025-06-20T06:39:24.589Z",
"log.level": "info",
"message": "안녕하세요",
"ecs.version": "1.6.0",
"log": {
"logger": "root",
"origin": {
"file": { "line": 10, "name": "" },
"function": ""
},
"original": "안녕하세요"
},
"process": {
"name": "MainProcess",
"pid": 302584,
"thread": { "id": 140083028806592, "name": "MainThread" }
}
}
```
Received output:
```json
{
"@timestamp": "2025-06-20T06:39:24.589Z",
"log.level": "info",
"message": "\uc548\ub155\ud558\uc138\uc694",
"ecs.version": "1.6.0",
"log": {
"logger": "root",
"origin": {
"file": { "line": 10, "name": "" },
"function": ""
},
"original": "\uc548\ub155\ud558\uc138\uc694"
},
"process": {
"name": "MainProcess",
"pid": 302584,
"thread": { "id": 140083028806592, "name": "MainThread" }
}
}
```
贡献指南
这个仓库没有索引到贡献指南
调研方向
首先在项目中搜索 json.dumps 以及 ecs_logging.StdlibFormatter 使用的 formatter。运行提供的 Python 复现代码,以确认当前经过转义的输出,然后验证非英语字符会直接出现在两个 message 字段中,同时结果仍然是有效的 JSON。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- observability
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 64/100