Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion source/logging.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ logging library, see the `Python logging library documentation <https://docs.pyt
Examples
--------

The follwing example sets the global logging level to ``INFO``:
The following example sets the global logging level to ``INFO``:

.. code-block:: python

Expand All @@ -52,6 +52,13 @@ The following example sets the log level on the ``pymongo.command`` component to
import logging
logging.getLogger("pymongo.command").setLevel(logging.DEBUG)

Messages that the driver outputs will have the log level specified at the beginning of the
message, as shown by this example ``DEBUG`` message:

.. code-block:: none

DEBUG:pymongo.command:{"clientId": {"$oid": "..."}, "message": "Command started", "command": "{\"insert\": \"test\", \"ordered\": true, \"lsid\": {\"id\": {\"$binary\": {\"base64\": \"...\", \"subType\": \"04\"}}}, \"$db\": \"db\", \"documents\": [{\"x\": 1, \"_id\": {\"$oid\": \"...\"}}]}", "commandName": "insert", "databaseName": "db", "requestId": ..., "operationId": ..., "driverConnectionId": 1, "serverConnectionId": 3554, "serverHost": "localhost", "serverPort": 27017}

Configuring Truncation
----------------------

Expand Down
Loading