Disable `ensure_ascii` on `json.dumps`

Open Beginner friendly
#170 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
64/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
observability

Research direction

Start by searching the project for json.dumps and the formatter used by ecs_logging.StdlibFormatter. Run the supplied Python reproduction to confirm the current escaped output, then verify that non-English characters appear directly in both message fields while the result remains valid JSON.

Written by the indexing model from the issue text.

Description

agent-python community triage

Current output is unreadable in console if any language other than English is used in the messages.

Reproduction code:

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:

{
  "@timestamp": "2025-06-20T06:39:24.589Z",
  "log.level": "info",
  "message": "안녕하세요",
  "ecs.version": "1.6.0",
  "log": {
    "logger": "root",
    "origin": {
      "file": { "line": 10, "name": "<python-input-2>" },
      "function": "<module>"
    },
    "original": "안녕하세요"
  },
  "process": {
    "name": "MainProcess",
    "pid": 302584,
    "thread": { "id": 140083028806592, "name": "MainThread" }
  }
}

Received output:

{
  "@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": "<python-input-2>" },
      "function": "<module>"
    },
    "original": "\uc548\ub155\ud558\uc138\uc694"
  },
  "process": {
    "name": "MainProcess",
    "pid": 302584,
    "thread": { "id": 140083028806592, "name": "MainThread" }
  }
}
Dominant language
Python
Stars
74
Forks
33
Avg merge
9h 3m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from elastic/ecs-logging-python

All issues in elastic/ecs-logging-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.