| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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.
|
Encountered the same issue. Would be very helpful if this will be merged. |
Sorry, something went wrong.
| message = super(LogzioHandler, self).format(record) | ||
| try: | ||
| if record.exc_info: | ||
| message = message.split("\nTraceback")[0] # only keep the original formatted message part |
There was a problem hiding this comment.
Thank you for reporting this issue.
When I tried recreating with the example you provided, the field message looks like this:
'{"additional_field": "value"}\nNoneType: None'
So this line doesn't fix it for me.
What about message = message.split("\n")[0] ?
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you for reporting this issue. When I tried recreating with the example you provided, the field message looks like this: '{"additional_field": "value"}\nNoneType: None' So this line doesn't fix it for me. What about message = message.split("\n")[0] ?
I agree with @mirii1994 's proposed change. Would it be possible to expedite this? Happy to take over if needed!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
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.