[issue27837] Logging Cookbook Improvement

2016-08-24 Thread Vinay Sajip
Vinay Sajip added the comment: The thing about queues does not relate just to logging - it relates to all communication between different multiprocessing processes, of which logging is just an example. The logging cookbook is not the place to provide tutorial information on e.g. multi-threadin

[issue27837] Logging Cookbook Improvement

2016-08-23 Thread Niko Yasui
Niko Yasui added the comment: I see, I didn't realize that the simpler code would break under certain conditions. While there are definitely simpler examples in other documents, I haven't been able to find any indication that there is a simpler way to do multiprocessing and logging together,

[issue27837] Logging Cookbook Improvement

2016-08-23 Thread Niko Yasui
Changes by Niko Yasui : Removed file: http://bugs.python.org/file44198/multi_log_cookbook.py ___ Python tracker ___ ___ Python-bugs-list maili

[issue27837] Logging Cookbook Improvement

2016-08-23 Thread Vinay Sajip
Vinay Sajip added the comment: > Since a queue isn't necessary for logging with multiprocessing IMO a queue with QueueHandler/QueueListener is best practice when working with multiprocessing and logging. If you don't use them, things may seem to work some of the time but could fail in certain

[issue27837] Logging Cookbook Improvement

2016-08-23 Thread Niko Yasui
Niko Yasui added the comment: Thank you both for the helpful comments. Vinay, since you want to illustrate a listener process in the multiprocessing example, why not include a shorter, simpler example beforehand? This is my first time using logging, and it took me multiple hours to figure out

[issue27837] Logging Cookbook Improvement

2016-08-23 Thread Vinay Sajip
Vinay Sajip added the comment: I specifically wanted to illustrate a separate listener process - the purpose here is not to show what might be the most efficient code, but to show communication via a queue between listener process and worker processes. You've removed this, which defeats the ob

[issue27837] Logging Cookbook Improvement

2016-08-23 Thread R. David Murray
R. David Murray added the comment: Can you provide this change as a diff, please? (See docs.python.org/devguide for information on generating reviewable patches). -- nosy: +r.david.murray, vinay.sajip ___ Python tracker

[issue27837] Logging Cookbook Improvement

2016-08-23 Thread Niko Yasui
New submission from Niko Yasui: Removed the unnecessary listener function and changed the worker loggers from root to children. Also replaced print statements with logging statements and a stdout handler to illustrate the usefulness of handler levels. This version also doesn't require a manual