SAP / cf-python-logging-support

Logging library for python applications deployed on SAP Cloud Platform - CloudFoundry environment
Apache License 2.0
17 stars 11 forks source link

Django Logging Issue - AttributeError: 'NoneType' object has no attribute 'context' #34

Closed adilmalik393 closed 6 years ago

adilmalik393 commented 6 years ago
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT     % (self.num_connections, self.host))
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT   File "/usr/local/lib/python3.6/logging/__init__.py", line 1298, in info
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT     Log 'msg % args' with severity 'INFO'.
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT   File "/usr/local/lib/python3.6/logging/__init__.py", line 1306, in info
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT     self._log(INFO, msg, args, **kwargs)
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT   File "/usr/local/lib/python3.6/logging/__init__.py", line 1441, in _log
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT     exc_info, func, extra, sinfo)
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT   File "/usr/local/lib/python3.6/site-packages/sap/cf_logging/__init__.py", line 36, in makeRecord
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT     func, *args, **kwargs)
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT   File "/usr/local/lib/python3.6/site-packages/sap/cf_logging/record/simple_log_record.py", line 34, in __init__
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT     self.correlation_id = framework.context.get_correlation_id(request) or defaults.UNKNOWN
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT   File "/usr/local/lib/python3.6/site-packages/sap/cf_logging/core/context.py", line 20, in get_correlation_id
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT     return self.get(_CORRELATION_ID_KEY, request)
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT   File "/usr/local/lib/python3.6/site-packages/sap/cf_logging/django_logging/context.py", line 23, in get
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT     _init_context(request)
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT   File "/usr/local/lib/python3.6/site-packages/sap/cf_logging/django_logging/context.py", line 13, in _init_context
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT     request.context = {}
   2018-09-12T11:17:06.52+0500 [APP/PROC/WEB/0] OUT AttributeError: 'NoneType' object has no attribute 'context'