Uploaded image for project: 'Near Realtime RAN Intelligent Controller'
  1. Near Realtime RAN Intelligent Controller
  2. RIC-40

python logging library explodes on tuples/json

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • None
    • None
    • None

      Prior to switching to the RIC logging library, this works in python's logger (python logger supports tuples/strings/json:

      logger.debug(("Dropping malformed or non applicable message", msg)) 

      However, after switching, this blows up:

      Traceback (most recent call last):
        File "/opt/pyenv/versions/3.7.4/lib/python3.7/threading.py", line 926, in _bootstrap_inner
          self.run()
        File "/opt/pyenv/versions/3.7.4/lib/python3.7/threading.py", line 870, in run
          self._target(*self._args, **self._kwargs)
        File "/w/workspace/ric-plt-a1-tox-verify-all/a1/a1rmr.py", line 110, in loop
          mdc_logger.debug(("Dropping malformed or non applicable message", msg))
        File "/w/workspace/ric-plt-a1-tox-verify-all/.tox/py37/lib/python3.7/site-packages/mdclogpy/Logger.py", line 105, in debug
          self.log(Level.DEBUG, message)
        File "/w/workspace/ric-plt-a1-tox-verify-all/.tox/py37/lib/python3.7/site-packages/mdclogpy/Logger.py", line 89, in log
          self._output_log(json.dumps(log_entry))
        File "/opt/pyenv/versions/3.7.4/lib/python3.7/json/__init__.py", line 231, in dumps
          return _default_encoder.encode(obj)
        File "/opt/pyenv/versions/3.7.4/lib/python3.7/json/encoder.py", line 199, in encode
          chunks = self.iterencode(o, _one_shot=True)
        File "/opt/pyenv/versions/3.7.4/lib/python3.7/json/encoder.py", line 257, in iterencode
          return _iterencode(o, 0)
        File "/opt/pyenv/versions/3.7.4/lib/python3.7/json/encoder.py", line 179, in default
          raise TypeError(f'Object of type {o.__class__.__name__} '
      TypeError: Object of type bytes is not JSON serializable
       

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            riska Roni Riska
            tommycarpenter Tommy Carpenter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: