Closed sharathsridhar closed 1 year ago
Obviously late, but hey maybe it'll help.
Your code above is defining how the output should be so changing %(message)s
to %(Message)s
will cause message to not appear in the JSON output.
If you want to rename the field, you can see how we do that here: https://github.com/madzak/python-json-logger/blob/master/tests/test_jsonlogger.py#L55
Basically you add rename_fields={'message': 'Message'}
to the JsonFormatter call:
formatter = jsonlogger.JsonFormatter("%(asctime)s %(filename)s %(module)s %(funcName)s %(lineno)s %(message)s", rename_fields={'message': 'Message'})
Hello, this isn't an issue, but wanted to know if there was an easier way to call
Message
instead ofmessage
or do we have to go theCustomJsonFormatter
class route? For example, how to change themessage
hereto
Message
, because changing it directly in this line of code wouldn't work?Thank you.