Skip to content

Commit

Permalink
[doc] Update documentation on logging optimization. (pythonGH-22075)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsajip authored and Seth Sims committed Oct 18, 2020
1 parent 8aded84 commit 085e838
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions Doc/howto/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1078,20 +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 ``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``. |
+-----------------------------------------------------+---------------------------------------------------+
| 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. | |
+-----------------------------------------------------+---------------------------------------------------+

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
Expand Down

0 comments on commit 085e838

Please sign in to comment.