Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-4470

PyMongo always logs in JSON/structured format, and does not respect app choices

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: 4.8
    • Component/s: Logging
    • None
    • Python Drivers

      Detailed steps to reproduce the problem?

      Enable logging and observe the output. It is always formatted as a JSON log (structured log) with an arbitrary format and not under control of the app. 

      Definition of done: what must be done to consider the task complete?

      Have formatting done by a proper PyMongo formatter (see https://docs.python.org/3/howto/logging.html) or have a way to override formatting in the LogMessage class so apps can chose what they want logged and how. Specifically filter fields, print the message in json format or not.

      The exact Python version used, with patch level:

      3.11.4 (main, Jun 20 2023, 16:59:59) [Clang 14.0.3 (clang-1403.0.22.14.1)]

      The exact version of PyMongo used, with patch level:

      4.7.2
      True

      Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.

      The operating system and version (e.g. Windows 7, OSX 10.8, ...)

      Web framework or asynchronous network library used, if any, with version (e.g. Django 1.7, mod_wsgi 4.3.0, gevent 1.0.1, Tornado 4.0.2, ...)

      Security Vulnerabilities

      If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            mongodb@exilium.com Bruno Silva
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: