Skip to content

Commit da3e9dd

Browse files
[3.9] [Doc] Add info to logging cookbook about running logging socket listeners i… (GH-29838) (GH-29840)
1 parent 3b9d886 commit da3e9dd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Doc/howto/logging-cookbook.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,17 @@ alternative there, as well as adapting the above script to use your alternative
541541
serialization.
542542

543543

544+
Running a logging socket listener in production
545+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
546+
547+
To run a logging listener in production, you may need to use a process-management tool
548+
such as `Supervisor <http://supervisord.org/>`_. `Here
549+
<https://gist.github.com/vsajip/4b227eeec43817465ca835ca66f75e2b>`_ is a Gist which
550+
provides the bare-bones files to run the above functionality using Supervisor: you
551+
will need to change the `/path/to/` parts in the Gist to reflect the actual paths you
552+
want to use.
553+
554+
544555
.. _context-info:
545556

546557
Adding contextual information to your logging output
@@ -982,6 +993,17 @@ to this (remembering to first import :mod:`concurrent.futures`)::
982993
for i in range(10):
983994
executor.submit(worker_process, queue, worker_configurer)
984995

996+
Deploying Web applications using Gunicorn and uWSGI
997+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
998+
999+
When deploying Web applications using `Gunicorn <https://gunicorn.org/>`_ or `uWSGI
1000+
<https://uwsgi-docs.readthedocs.io/en/latest/>`_ (or similar), multiple worker
1001+
processes are created to handle client requests. In such environments, avoid creating
1002+
file-based handlers directly in your web application. Instead, use a
1003+
:class:`SocketHandler` to log from the web application to a listener in a separate
1004+
process. This can be set up using a process management tool such as Supervisor - see
1005+
`Running a logging socket listener in production`_ for more details.
1006+
9851007

9861008
Using file rotation
9871009
-------------------

0 commit comments

Comments
 (0)