summaryrefslogtreecommitdiffstats
path: root/Doc/library/logging.rst
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2009-08-15 23:23:37 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2009-08-15 23:23:37 (GMT)
commita7471bf334036b79109858c10203d98a87ea37ee (patch)
treeabc688afc0fa4f012cef24fb5c7e78ccddc84f2f /Doc/library/logging.rst
parent4d51aaaa46b4fc4acf84330971335a1c4d9bbf80 (diff)
downloadcpython-a7471bf334036b79109858c10203d98a87ea37ee.zip
cpython-a7471bf334036b79109858c10203d98a87ea37ee.tar.gz
cpython-a7471bf334036b79109858c10203d98a87ea37ee.tar.bz2
Added section on logging to one file from multiple processes.
Diffstat (limited to 'Doc/library/logging.rst')
-rw-r--r--Doc/library/logging.rst15
1 files changed, 15 insertions, 0 deletions
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst
index c78aeb8..58bda37 100644
--- a/Doc/library/logging.rst
+++ b/Doc/library/logging.rst
@@ -1316,6 +1316,21 @@ When this script is run, the output should look something like this::
2008-01-18 14:49:54,033 d.e.f WARNING IP: 127.0.0.1 User: jim A message at WARNING level with 2 parameters
+Logging to a single file from multiple processes
+------------------------------------------------
+
+Although logging is thread-safe, and logging to a single file from multiple
+threads in a single process *is* supported, logging to a single file from
+*multiple processes* is *not* supported, because there is no standard way to
+serialize access to a single file across multiple processes in Python. If you
+need to log to a single file from multiple processes, the best way of doing
+this is to have all the processes log to a :class:`SocketHandler`, and have a
+separate process which implements a socket server which reads from the socket
+and logs to file. (If you prefer, you can dedicate one thread in one of the
+existing processes to perform this function.) The following section documents
+this approach in more detail and includes a working socket receiver which can
+be used as a starting point for you to adapt in your own applications.
+
.. _network-logging:
Sending and receiving logging events across a network