[Python-checkins] [doc] Update cookbook example and add information about queue types. (GH-94854)
vsajip
webhook-mailer at python.org
Fri Jul 15 01:04:08 EDT 2022
https://github.com/python/cpython/commit/dc54193095e8ac8d73489f7ab133e016a5556256
commit: dc54193095e8ac8d73489f7ab133e016a5556256
branch: main
author: Vinay Sajip <vinay_sajip at yahoo.co.uk>
committer: vsajip <vinay_sajip at yahoo.co.uk>
date: 2022-07-15T06:03:58+01:00
summary:
[doc] Update cookbook example and add information about queue types. (GH-94854)
files:
M Doc/howto/logging-cookbook.rst
M Doc/library/logging.handlers.rst
diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst
index 7f4fe3a63a702..321c4bc510ad9 100644
--- a/Doc/howto/logging-cookbook.rst
+++ b/Doc/howto/logging-cookbook.rst
@@ -219,7 +219,7 @@ messages should not. Here's how you can achieve this::
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
datefmt='%m-%d %H:%M',
- filename='/temp/myapp.log',
+ filename='/tmp/myapp.log',
filemode='w')
# define a Handler which writes INFO messages or higher to the sys.stderr
console = logging.StreamHandler()
@@ -270,6 +270,11 @@ are sent to both destinations.
This example uses console and file handlers, but you can use any number and
combination of handlers you choose.
+Note that the above choice of log filename ``/tmp/myapp.log`` implies use of a
+standard location for temporary files on POSIX systems. On Windows, you may need to
+choose a different directory name for the log - just ensure that the directory exists
+and that you have the permissions to create and update files in it.
+
Configuration server example
----------------------------
diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst
index 1447cabb9a1df..0dc05255db9cb 100644
--- a/Doc/library/logging.handlers.rst
+++ b/Doc/library/logging.handlers.rst
@@ -1018,6 +1018,8 @@ possible, while any potentially slow operations (such as sending an email via
have the task tracking API, which means that you can use
:class:`~queue.SimpleQueue` instances for *queue*.
+ .. note:: If you are using :mod:`multiprocessing`, you should avoid using
+ :class:`~queue.SimpleQueue` and instead use :class:`multiprocessing.Queue`.
.. method:: emit(record)
@@ -1091,6 +1093,9 @@ possible, while any potentially slow operations (such as sending an email via
task tracking API (though it's used if available), which means that you can
use :class:`~queue.SimpleQueue` instances for *queue*.
+ .. note:: If you are using :mod:`multiprocessing`, you should avoid using
+ :class:`~queue.SimpleQueue` and instead use :class:`multiprocessing.Queue`.
+
If ``respect_handler_level`` is ``True``, a handler's level is respected
(compared with the level for the message) when deciding whether to pass
messages to that handler; otherwise, the behaviour is as in previous Python
More information about the Python-checkins
mailing list