From da3e9ddde7861d29ab465e8ab1e112693f689a79 Mon Sep 17 00:00:00 2001
From: "Miss Islington (bot)"
<31488909+miss-islington@users.noreply.github.com>
Date: Mon, 29 Nov 2021 05:49:20 -0800
Subject: [PATCH] =?utf8?q?[3.9]=20[Doc]=20Add=20info=20to=20logging=20cook?=
=?utf8?q?book=20about=20running=20logging=20socket=20listeners=20i?=
=?utf8?q?=E2=80=A6=20(GH-29838)=20(GH-29840)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
---
Doc/howto/logging-cookbook.rst | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst
index 20b02c838f32..bc9b2499224c 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 `_. `Here
+`_ 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 `_ or `uWSGI
+`_ (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
-------------------
--
2.47.3