Mercurial > moin > 1.9
changeset 2995:8d4d5795f1f2
thfcgi: improve logging (port from 1.6)
author | Thomas Waldmann <tw AT waldmann-edv DOT de> |
---|---|
date | Sun, 06 Jan 2008 16:57:28 +0100 |
parents | bbe70e8ffe62 |
children | 6a1b18869fe8 |
files | MoinMoin/support/thfcgi.py |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/support/thfcgi.py Sun Jan 06 16:55:11 2008 +0100 +++ b/MoinMoin/support/thfcgi.py Sun Jan 06 16:57:28 2008 +0100 @@ -584,11 +584,13 @@ def run(self): """Wait & serve. Calls request_handler on every request.""" self.sock.listen(self.backlog) - log("Starting Process") + pid = os.getpid() + log("Starting Process (PID=%d)" % pid) running = True while running: if not self.requests_left: # self.sock.shutdown(RDWR) here does NOT help with backlog + log("Maximum number of processed requests reached, terminating this worker process (PID=%d)..." % pid) running = False elif self.requests_left > 0: self.requests_left -= 1 @@ -596,13 +598,12 @@ conn, addr = self.sock.accept() threadcount = _threading.activeCount() if threadcount < self.max_threads: - log("Accepted connection, starting thread...") + log("Accepted connection, %d active threads, starting worker thread..." % threadcount) t = _threading.Thread(target=self.accept_handler, args=(conn, addr, True)) t.start() else: - log("Accepted connection, running in main-thread...") + log("Accepted connection, %d active threads, running in main thread..." % threadcount) self.accept_handler(conn, addr, False) - log("Active Threads: %d" % _threading.activeCount()) self.sock.close() - log("Ending Process") + log("Ending Process (PID=%d)" % pid)