Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix message formatting while handling exceptions
Consider the following format: ``` LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'logzioFormat': { 'format': '{"additional_field": "value"}', 'validate': False } }, 'handlers': { 'logzio': { 'class': 'logzio.handler.LogzioHandler', 'level': 'INFO', 'formatter': 'logzioFormat', 'token': '<<LOGZIO-TOKEN>>', 'logzio_type': 'python-handler', 'logs_drain_timeout': 5, 'url': 'https://<<LOGZIO-URL>>:8071', 'retries_no': 4, 'retry_timeout': 2, } }, 'loggers': { '': { 'level': 'DEBUG', 'handlers': ['logzio'], 'propagate': True } } } ``` And the case, where the user logs an exception: ``` logger.exception("Something") ``` Python appends the exception traceback to the formatted message (`{"additional_field": "value"}` originally). Which would result in the logzio handler not being able to parse it as JSON, and thus not adding the additional fields to the log.
- Loading branch information