Change Log🔗
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
4.0.0 - 2025-10-06🔗
Added🔗
- Support
DictConfiguratorprefixes forrename_fieldsandstatic_fields. #45- Allows using values like
ext://sys.stderrinfileConfig/dictConfigvalue fields.
- Allows using values like
- Support comma seperated lists for Formatter
fmt(style=",") e.g."asctime,message,levelname"#15- Note that this style is specific to
python-json-loggerand thus care should be taken not to pass this format to other logging Formatter implementations.
- Note that this style is specific to
- Supports sequences of strings (e.g. lists and tuples) of field names for Formatter
fmt. #16
Changed🔗
- Rename
pythonjsonlogger.core.LogRecordandlog_recordarguments to avoid confusion / overlapping withlogging.LogRecord. #38- Affects arguments to
pythonjsonlogger.core.BaseJsonFormatter(and any child classes).serialize_log_recordadd_fieldsjsonify_log_recordprocess_log_record
- Note: functions referring to
log_recordhave not had their function name changed.
- Affects arguments to
Removed🔗
- Remove support for providing strings instead of objects when instantiating formatters. Instead use the
DictConfiguratorext://prefix format when usingfileConfig/dictConfig. #47- Affects
pythonjsonlogger.json.JsonFormatter:json_default,json_encoder,json_serializer. - Affects
pythonjsonlogger.orjson.OrjsonFormatter:json_default. - Affects
pythonjsonlogger.msgspec.MsgspecFormatter:json_default.
- Affects
Thanks @rubensa
3.3.0 - 2025-03-06🔗
Added🔗
exc_info_as_arrayandstack_info_as_arrayoptions are added topythonjsonlogger.core.BaseJsonFormatterallowing both to be encoded as list of lines instead of a single multi-line string. #35
Security🔗
- Remove
msgspec-python313-prefromdevdependencies preventing potential RCE. Details: GHSA-wmxh-pxcx-9w24
Thanks @1hakusai1 and @omnigodz
3.2.1 - 2024-12-16🔗
Fixed🔗
- Import error on
import pythonjsonlogger.jsonlogger#29
3.2.0 - 2024-12-11🔗
Changed🔗
pythonjsonlogger.[ORJSON,MSGSPEC]_AVAILABLEno longer imports the respective package when determining availability.pythonjsonlogger.[orjson,msgspec]now throws apythonjsonlogger.exception.MissingPackageErrorwhen required libraries are not available. These contain more information about what is missing whilst still being anImportError.defaultsparameter is no longer ignored and now conforms to the standard library. Setting a defaults dictionary will add the specified keys if the those keys do not exist in a record or weren't passed by theextraparameter when logging a message.typing_extensionsis only installed on Python version < 3.10.- Support Python 3.13
msgspechas only been tested against pre-release versions.
Thanks @cjwatson and @bharel
3.1.0 - 2023-05-28🔗
This splits common funcitonality out to allow supporting other JSON encoders. Although this is a large refactor, backwards compatibility has been maintained.
Added🔗
pythonjsonlogger.core- more details below.pythonjsonlogger.defaultsmodule that provides many functions for handling unsupported types.- Orjson encoder support via
pythonjsonlogger.orjson.OrjsonFormatterwith the following additions:- bytes are URL safe base64 encoded.
- Exceptions are "pretty printed" using the exception name and message e.g.
"ValueError: bad value passed" - Enum values use their value, Enum classes now return all values as a list.
- Tracebacks are supported
- Classes (aka types) are support
- Will fallback on
__str__if available, else__repr__if available, else will use__could_not_encode__
- MsgSpec encoder support via
pythonjsonlogger.msgspec.MsgspecFormatterwith the following additions:- Exceptions are "pretty printed" using the exception name and message e.g.
"ValueError: bad value passed" - Enum classes now return all values as a list.
- Tracebacks are supported
- Classes (aka types) are support
- Will fallback on
__str__if available, else__repr__if available, else will use__could_not_encode__ - Note: msgspec only supprts enum values of type
intorstrjcrist/msgspec#680
- Exceptions are "pretty printed" using the exception name and message e.g.
Changed🔗
pythonjsonlogger.jsonloggerhas been moved topythonjsonlogger.jsonwith core functionality moved topythonjsonlogger.core.pythonjsonlogger.core.BaseJsonFormatterproperly supports alllogging.Formatterarguments:fmtis unchanged.datefmtis unchanged.stylecan now support non-standard arguments by settingvalidatetoFalsevalidateallows non-standardstylearguments or prevents callingvalidateon standardstylearguments.defaultis ignored.
pythonjsonlogger.json.JsonFormatterdefault encodings changed:- bytes are URL safe base64 encoded.
- Exception formatting detected using
BaseExceptioninstead ofException. Now "pretty prints" the exception using the exception name and message e.g."ValueError: bad value passed" - Dataclasses are now supported
- Enum values now use their value, Enum classes now return all values as a list.
- Will fallback on
__str__if available, else__repr__if available, else will use__could_not_encode__
- Renaming fields now preserves order (#7) and ignores missing fields (#6).
- Documentation
- Generated documentation using
mkdocsis stored indocs/ - Documentation within
README.mdhas been moved todocs/index.mdanddocs/qucikstart.md. CHANGELOG.mdhas been moved todocs/change-log.mdSECURITY.mdhas been moved and replaced with a symbolic link todocs/security.md.
- Generated documentation using
Deprecated🔗
pythonjsonlogger.jsonloggeris nowpythonjsonlogger.jsonpythonjsonlogger.jsonlogger.RESERVED_ATTRSis nowpythonjsonlogger.core.RESERVED_ATTRS.pythonjsonlogger.jsonlogger.merge_record_extrais nowpythonjsonlogger.core.merge_record_extra.
Removed🔗
- Python 3.7 support dropped
pythonjsonlogger.jsonlogger.JsonFormatter._str_to_fnreplaced withpythonjsonlogger.core.str_to_object.
3.0.1 - 2023-04-01🔗
Fixes🔗
- Fix spelling of parameter
json_serialiser->json_serializer(#8) - @juliangilbey
3.0.0 - 2024-03-25🔗
Note: using new major version to seperate changes from this fork and the original (upstream). See #1 for details.
Changes🔗
- Update supported Python versions - @nhairs
- Drop 3.6
- The following versions are supported and tested:
- CPython 3.7-3.12 (ubuntu, windows, mac)
- PyPy 3.7-3.10 (ubuntu, wundows, mac)
RESERVED_ATTRSis now a list and version dependent
- Fix
JsonFormatter.__init__return type (None) - @nhairs - Moved to
pyproject.toml- @nhairs - Update linting and testing - @nhairs
- Split lint and test steps in GHA
- Use validate-pyproject, black, pylint, mypy
2.0.7 - 2023-02-21🔗
Changed🔗
- Fix inclusion of py.typed in pip packages - @sth
- Added pytest support with test file rename. Migrated to assertEqual
2.0.6 - 2023-02-14🔗
Changed🔗
- Parameter
rename_fieldsin merge_record_extra is now optional - @afallou
2.0.5 - 2023-02-12🔗
Added🔗
- Allow reserved attrs to be renamed - @henkhogan
- Support added for Python 3.11
- Now verifying builds in Pypy 3.9 as well
- Type annotations are now in the package - @louis-jaris
Changed🔗
- Fix rename_fields for exc_info - @guilhermeferrari
- Cleaned up test file for PEP8 - @lopagela
- Cleaned up old Python 2 artifacts - @louis-jaris
- Dropped Python 3.5 support - @idomozes
- Moved type check via tox into 3.11 run only
- Added test run in Python3.6 (will keep for a little while longer, but it's EOL so upgrade)
2.0.4 - 2022-07-11🔗
Changed🔗
- Fix too strict regex for percentage style logging - @aberres
2.0.3 - 2022-07-08🔗
Added🔗
- Add PEP 561 marker/basic mypy configuration. - @bringhurst
- Workaround logging.LogRecord.msg type of string. - @bringhurst
Changed🔗
- Changed a link archive of the reference page in case it's down. - @ahonnecke
- Removed unnecessary try-except around OrderedDict usage - @sozofaan
- Update documentation link to json module + use https - @deronnax
- Dropped 3.5 support. - @bringhurst
2.0.2 - 2021-07-27🔗
Added🔗
- Officially supporting 3.9 - @felixonmars.
- You can now add static fields to log objects - @cosimomeli.
Changed🔗
- Dropped 3.4 support.
- Dropped Travis CI for Github Actions.
- Wheel should build for python 3 instead of just 3.4 now.
2.0.1 - 2020-10-12🔗
Added🔗
- Support Pypi long descripton - @ereli-cb
Changed🔗
- You can now rename output fields - @schlitzered
2.0.0 - 2020-09-26🔗
Added🔗
- New Changelog
- Added timezone support to timestamps - @lalten
- Refactored log record to function - @georgysavva
- Add python 3.8 support - @tommilligan
Removed🔗
- Support for Python 2.7
- Debian directory
0.1.11 - 2019-03-29🔗
Added🔗
- Support for Python 3.7
Changed🔗
- 'stack_info' flag in logging calls is now respected in JsonFormatter by @ghShu