I have a simple webservice written in Python WSGI, it's running in Apache and modwsgi using the WSGIDaemonProcess processes=4 directive. 

How do I add logging? Obviously I can't log to the same file without some sort of mutex, but I don't want performance degraded.

The logging can't block. As far as I know the standard logging module blocks on every log call.

I was thinking of doing some sort of socket logging, is this viable? Would it require a "server" process to receive logging? What happens if the server isn't on?