Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Using rename fields changes the key order of the log output #169

Closed
vpmedia opened this issue Feb 21, 2023 · 2 comments
Closed

Using rename fields changes the key order of the log output #169

vpmedia opened this issue Feb 21, 2023 · 2 comments

Comments

@vpmedia
Copy link

vpmedia commented Feb 21, 2023

When I rename some of the default field names using rename_fields={key:key} they are logged at the end of the json output.

current behaviour:

Log output without rename fields:
{"asctime": "2023-02-21T22:02:12+0100", "levelname": "INFO", "name": "werkzeug", "funcName": "_log", "message": "127.0.0.1"}

Log output with rename fields:
{"name": "werkzeug", "funcName": "_log", "message": "127.0.0.1", "time": "2023-02-21T22:02:12+0100", "level": "INFO"}

expected behaviour:

Log output without rename fields:
{"asctime": "2023-02-21T22:02:12+0100", "levelname": "INFO", "name": "werkzeug", "funcName": "_log", "message": "127.0.0.1"}

Log output with rename fields:
{"time": "2023-02-21T22:02:12+0100", "level": "INFO", "name": "werkzeug", "funcName": "_log", "message": "127.0.0.1"}

--

used version: v2.0.7
used format: "%(asctime)s %(levelname)s %(name)s %(funcName)s %(message)s"

@vpmedia
Copy link
Author

vpmedia commented Feb 22, 2023

And as a side comment I'm pretty sure this was working as expected a few versions before so some of the newer commits must have changed the behaviour.
v2.0.4 works correctly
v2.0.5 works unexpectedly

@nhairs
Copy link

nhairs commented May 28, 2024

As it looks like python-json-logger is currently unmaintained, I am working on a maintained fork.

I've fixed this in the v3.1.0 release.

@vpmedia vpmedia closed this as not planned Won't fix, can't repro, duplicate, stale Sep 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants