Implemented a listener for logging incoming requests and outgoing responses.