elastic / elastic/ecs-logging-python

Disable `ensure_ascii` on `json.dumps`

Open
#170 0 comments 0 reactions 0 assignees View on GitHub
agent-python community triage
Dominant language
Python
Stars
74
Forks
33
Avg merge
9h 3m
Merged PRs (30d)
1

Description

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" }
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.