Most people would just log to stdout/stderr which means log output gets routed 
into the Apache error log files. Apache's mechanism for handling log files when 
multiple processes are present seems to work fine. If you have multiple sites 
on the Apache server then configure Apache to use different log files for each 
VirtualHost as a way of keeping log files for different application separate.

Is there a specific reason you are using Python logging system mechanisms to 
write to distinct log files (if that is what you meant you are doing)?

Note that most issues with using a single log file for multiple processes 
revolve around initial log file creation and log file rotation. In Apache log 
files are initially created from the parent process so there is no race 
condition on creation. It has a means to handle log file rotation as well, 
although many Linux systems rely on log rotate service instead.

Graham

> On 27 Oct 2022, at 5:50 am, Steve <[email protected]> wrote:
> 
> Hi, I am running a Flask app using mod_wsgi and I've been logging to a file. 
> The issue is now I need to run it using multiple processes but multiple 
> processes logging to a file without coordination is not a good idea.
> 
> Has anyone heard of a success case where they log to stderr with multiple 
> processes? That's the approach that I am hoping to take as other approaches 
> seem too overkill as of right now because they require to spin up some 
> service independent of the Flask app to handle the logs. 
> 
> And another question, does mod_wsgi do something special with opened files 
> with multiple processes? As I have tested logging with multiple processes to 
> the same file and have not found any issues.
> 
> Thanks!
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/modwsgi/71b85a03-2818-4492-bbe2-b61344746948n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/modwsgi/71b85a03-2818-4492-bbe2-b61344746948n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/7A72BF3E-C59C-4706-852D-41DD58F80323%40gmail.com.

Reply via email to