diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2021-11-29 13:06:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-29 13:06:52 (GMT) |
commit | 39b60ceae820a86d730ebdd1ee8cf5370bf5dff8 (patch) | |
tree | 71d632043b3410757e3bf56a077c2b53e8269856 /Doc | |
parent | 60929576e40038ec71d896230f69e4411c82be4b (diff) | |
download | cpython-39b60ceae820a86d730ebdd1ee8cf5370bf5dff8.zip cpython-39b60ceae820a86d730ebdd1ee8cf5370bf5dff8.tar.gz cpython-39b60ceae820a86d730ebdd1ee8cf5370bf5dff8.tar.bz2 |
[Doc] Add info to logging cookbook about running logging socket listeners i… (GH-29838)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/howto/logging-cookbook.rst | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst index 5a8d92a..f0d9449 100644 --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -541,6 +541,17 @@ alternative there, as well as adapting the above script to use your alternative serialization. +Running a logging socket listener in production +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To run a logging listener in production, you may need to use a process-management tool +such as `Supervisor <http://supervisord.org/>`_. `Here +<https://gist.github.com/vsajip/4b227eeec43817465ca835ca66f75e2b>`_ is a Gist which +provides the bare-bones files to run the above functionality using Supervisor: you +will need to change the `/path/to/` parts in the Gist to reflect the actual paths you +want to use. + + .. _context-info: Adding contextual information to your logging output @@ -982,6 +993,17 @@ to this (remembering to first import :mod:`concurrent.futures`):: for i in range(10): executor.submit(worker_process, queue, worker_configurer) +Deploying Web applications using Gunicorn and uWSGI +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +When deploying Web applications using `Gunicorn <https://gunicorn.org/>`_ or `uWSGI +<https://uwsgi-docs.readthedocs.io/en/latest/>`_ (or similar), multiple worker +processes are created to handle client requests. In such environments, avoid creating +file-based handlers directly in your web application. Instead, use a +:class:`SocketHandler` to log from the web application to a listener in a separate +process. This can be set up using a process management tool such as Supervisor - see +`Running a logging socket listener in production`_ for more details. + Using file rotation ------------------- |