From d04b35cab5e09a5a3b55b58ba41b778d234665cb Mon Sep 17 00:00:00 2001 From: Pallavi Bharadwaj Date: Sat, 4 Jan 2020 14:03:04 -0800 Subject: [PATCH 1/2] descriptive log for port unavailable and port-retries=0 --- notebook/notebookapp.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index cfee169e0c..e1bac4923b 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -1502,8 +1502,12 @@ def init_webapp(self): success = True break if not success: - self.log.critical(_('ERROR: the notebook server could not be started because ' + if self.port_retries: + self.log.critical(_('ERROR: the notebook server could not be started because ' 'no available port could be found.')) + else: + self.log.critical(_('ERROR: the notebook server could not be started because ' + 'port %i is not available.') % port) self.exit(1) @property From 5996cdf6a4d2f23a63cbce435388f5d45bc01d98 Mon Sep 17 00:00:00 2001 From: Pallavi Bharadwaj Date: Sun, 5 Jan 2020 22:40:18 -0800 Subject: [PATCH 2/2] descriptive log info for port in use and port-retries=0 --- notebook/notebookapp.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index e1bac4923b..a657ce82d5 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -1490,10 +1490,13 @@ def init_webapp(self): self.http_server.listen(port, self.ip) except socket.error as e: if e.errno == errno.EADDRINUSE: - self.log.info(_('The port %i is already in use, trying another port.') % port) + if self.port_retries: + self.log.info(_('The port %i is already in use, trying another port.') % port) + else: + self.log.info(_('The port %i is already in use.') % port) continue elif e.errno in (errno.EACCES, getattr(errno, 'WSAEACCES', errno.EACCES)): - self.log.warning(_("Permission to listen on port %i denied") % port) + self.log.warning(_("Permission to listen on port %i denied.") % port) continue else: raise