httpserver: add error handler that write to the logger

(From OE-Core rev: d3656cf1f749fea837ac2e263f505fcb18965839)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit a4bcca3123685f410fc99e5cc23f2b8f39fd0a63)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton
2023-01-31 16:30:22 +00:00
committed by Richard Purdie
parent c7e7b27363
commit a15fd63dfc

View File

@@ -40,6 +40,12 @@ class HTTPService(object):
self.port = self.server.server_port
self.process = multiprocessing.Process(target=self.server.server_start, args=[self.root_dir, self.logger])
def handle_error(self, request, client_address):
import traceback
exception = traceback.format_exc()
self.logger.warn("Exception when handling %s: %s" % (request, exception))
self.server.handle_error = handle_error
# The signal handler from testimage.bbclass can cause deadlocks here
# if the HTTPServer is terminated before it can restore the standard
#signal behaviour