From 13501268d11c7244dff4675e951ec4d46b00b0a7 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Thu, 3 Sep 2020 09:59:42 +0100 Subject: [PATCH 1/3] Update documentation on logging optimization. --- Doc/howto/logging.rst | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/Doc/howto/logging.rst b/Doc/howto/logging.rst index 6316e086ef43ba..1149e9c4ab8a4e 100644 --- a/Doc/howto/logging.rst +++ b/Doc/howto/logging.rst @@ -1078,20 +1078,21 @@ need more precise control over what logging information is collected. Here's a list of things you can do to avoid processing during logging which you don't need: -+-----------------------------------------------+----------------------------------------+ -| What you don't want to collect | How to avoid collecting it | -+===============================================+========================================+ -| Information about where calls were made from. | Set ``logging._srcfile`` to ``None``. | -| | This avoids calling | -| | :func:`sys._getframe`, which may help | -| | to speed up your code in environments | -| | like PyPy (which can't speed up code | -| | that uses :func:`sys._getframe`). | -+-----------------------------------------------+----------------------------------------+ -| Threading information. | Set ``logging.logThreads`` to ``0``. | -+-----------------------------------------------+----------------------------------------+ -| Process information. | Set ``logging.logProcesses`` to ``0``. | -+-----------------------------------------------+----------------------------------------+ ++-----------------------------------------------+---------------------------------------------------+ +| What you don't want to collect | How to avoid collecting it | ++===============================================+===================================================+ +| Information about where calls were made from. | Set ``logging._srcfile`` to ``None``. | +| | This avoids calling :func:`sys._getframe`, which | +| | may help to speed up your code in environments | +| | like PyPy (which can't speed up code that uses | +| | :func:`sys._getframe`). | ++-----------------------------------------------+---------------------------------------------------+ +| Threading information. | Set ``logging.logThreads`` to ``False``. | ++-----------------------------------------------+---------------------------------------------------+ +| Process information. | Set ``logging.logProcesses`` to ``False``. | ++-----------------------------------------------+---------------------------------------------------+ +| Multiprocess information. | Set ``logging.logMultiprocessing`` to ``False``. | ++-----------------------------------------------+---------------------------------------------------+ Also note that the core logging module only includes the basic handlers. If you don't import :mod:`logging.handlers` and :mod:`logging.config`, they won't From 35b83d3e1c6435cd5cdeda76b4cd45ac6833c236 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Thu, 3 Sep 2020 12:05:36 +0100 Subject: [PATCH 2/3] Refine documentation change. --- Doc/howto/logging.rst | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/Doc/howto/logging.rst b/Doc/howto/logging.rst index 1149e9c4ab8a4e..1d609f23c497f5 100644 --- a/Doc/howto/logging.rst +++ b/Doc/howto/logging.rst @@ -1078,21 +1078,22 @@ need more precise control over what logging information is collected. Here's a list of things you can do to avoid processing during logging which you don't need: -+-----------------------------------------------+---------------------------------------------------+ -| What you don't want to collect | How to avoid collecting it | -+===============================================+===================================================+ -| Information about where calls were made from. | Set ``logging._srcfile`` to ``None``. | -| | This avoids calling :func:`sys._getframe`, which | -| | may help to speed up your code in environments | -| | like PyPy (which can't speed up code that uses | -| | :func:`sys._getframe`). | -+-----------------------------------------------+---------------------------------------------------+ -| Threading information. | Set ``logging.logThreads`` to ``False``. | -+-----------------------------------------------+---------------------------------------------------+ -| Process information. | Set ``logging.logProcesses`` to ``False``. | -+-----------------------------------------------+---------------------------------------------------+ -| Multiprocess information. | Set ``logging.logMultiprocessing`` to ``False``. | -+-----------------------------------------------+---------------------------------------------------+ ++-----------------------------------------------------+---------------------------------------------------+ +| What you don't want to collect | How to avoid collecting it | ++=====================================================+===================================================+ +| Information about where calls were made from. | Set ``logging._srcfile`` to ``None``. | +| | This avoids calling :func:`sys._getframe`, which | +| | may help to speed up your code in environments | +| | like PyPy (which can't speed up code that uses | +| | :func:`sys._getframe`). | ++-----------------------------------------------------+---------------------------------------------------+ +| Threading information. | Set ``logging.logThreads`` to ``False``. | ++-----------------------------------------------------+---------------------------------------------------+ +| Current process ID (``os.getpid()``) | Set ``logging.logProcesses`` to ``False``. | ++-----------------------------------------------------+---------------------------------------------------+ +| Current process name when using ``multiprocessing`` | Set ``logging.logMultiprocessing`` to ``False``. | +| to manage multiple processes. | | ++-----------------------------------------------------+---------------------------------------------------+ Also note that the core logging module only includes the basic handlers. If you don't import :mod:`logging.handlers` and :mod:`logging.config`, they won't From a0e60e303fb1e4b135b792eda2c6b279272d79f6 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Thu, 3 Sep 2020 12:26:28 +0100 Subject: [PATCH 3/3] Add a cross-reference. --- Doc/howto/logging.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/howto/logging.rst b/Doc/howto/logging.rst index 1d609f23c497f5..b4dd9206c9d524 100644 --- a/Doc/howto/logging.rst +++ b/Doc/howto/logging.rst @@ -1089,7 +1089,7 @@ need: +-----------------------------------------------------+---------------------------------------------------+ | Threading information. | Set ``logging.logThreads`` to ``False``. | +-----------------------------------------------------+---------------------------------------------------+ -| Current process ID (``os.getpid()``) | Set ``logging.logProcesses`` to ``False``. | +| Current process ID (:func:`os.getpid`) | Set ``logging.logProcesses`` to ``False``. | +-----------------------------------------------------+---------------------------------------------------+ | Current process name when using ``multiprocessing`` | Set ``logging.logMultiprocessing`` to ``False``. | | to manage multiple processes. | |