Skip to content

Commit

Permalink
Better log for debugging (#46825)
Browse files Browse the repository at this point in the history
We are seeing logs as below from Chromium bots. Add more information to
log to make debugging easier.

Two kind of error log to address here:
1) No handler for resource: '/404'
2) WebDriver was not accessible within the timeout:

Bug: chromedriver:4793
  • Loading branch information
WeizhongX authored and sadym-chromium committed Jul 18, 2024
1 parent db1eb91 commit 6aa72f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def parse_request(self):
self._logger.info('Request basic authentication')
return False

whole_path = self.path
host, port, resource = http_header_util.parse_uri(self.path)
if resource is None:
self._logger.info('Invalid URI: %r', self.path)
Expand Down Expand Up @@ -247,7 +248,7 @@ def parse_request(self):
# Fallback to default http handler for request paths for which
# we don't have request handlers.
if not self._options.dispatcher.get_handler_suite(self.path):
self._logger.info('No handler for resource: %r', self.path)
self._logger.info('No handler for resource: %r', whole_path)
self._logger.info('Fallback to CGIHTTPRequestHandler')
return True
except dispatch.DispatchException as e:
Expand Down
9 changes: 4 additions & 5 deletions tools/wptrunner/wptrunner/browsers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def _run_server(self, group_metadata: GroupMetadata, **kwargs: Any) -> None:
env=self.env,
storeOutput=False)

self.logger.debug("Starting WebDriver: %s" % ' '.join(cmd))
self.logger.info("Starting WebDriver: %s" % ' '.join(cmd))
try:
self._proc.run()
except OSError as e:
Expand All @@ -378,13 +378,12 @@ def _run_server(self, group_metadata: GroupMetadata, **kwargs: Any) -> None:
server_process=self._proc,
)
except Exception:
self.logger.error(
"WebDriver was not accessible "
f"within the timeout:\n{traceback.format_exc()}")
self.logger.error(f"WebDriver was not accessible within {self.init_timeout} seconds.")
self.logger.error(traceback.format_exc())
raise
finally:
self._output_handler.start(group_metadata=group_metadata, **kwargs)
self.logger.debug("_run complete")
self.logger.info("Webdriver started successfully.")

def stop(self, force: bool = False) -> bool:
self.logger.debug("Stopping WebDriver")
Expand Down

0 comments on commit 6aa72f6

Please sign in to comment.