Skip to content

Disable ensure_ascii on json.dumps #170

Open
@rijenkii

Description

@rijenkii

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions