diff --git a/scripts/avocado b/scripts/avocado index f76600055950433d6134a35f07c39793c14b2a50..1a0eaf71fd9f2589fb058dbe6cab143d470092d5 100755 --- a/scripts/avocado +++ b/scripts/avocado @@ -16,7 +16,6 @@ import sys try: - import logging import os import tempfile import traceback @@ -29,11 +28,10 @@ except: def handle_exception(*exc_info): - # Print traceback into avocado.app.traceback if initialized + # Print traceback if AVOCADO_LOG_DEBUG environment variable is set msg = "Avocado crashed:\n" + "".join(traceback.format_exception(*exc_info)) - log = logging.getLogger("avocado.app.tracebacks") - if getattr(log, "handlers", False): - log.error(msg) + if os.environ.get("AVOCADO_LOG_DEBUG"): + os.write(2, msg + '\n') # Store traceback in data_dir or TMPDIR crash_dir = None prefix = "avocado-traceback-" @@ -52,17 +50,7 @@ def handle_exception(*exc_info): # Print friendly message in console-like output msg = ("Avocado crashed unexpectedly: %s\nYou can find details in %s" % (exc_info[1], name)) - for name in ("avocado.app", "avocado.test", None): - log = logging.getLogger(name) - for handler in getattr(log, "handlers", []): - if isinstance(handler, logging.StreamHandler): - break - else: - continue - log.critical(msg) - break - else: # Log not found, use stderr and hope it's enabled - sys.stderr.write(msg + '\n') + os.write(2, msg + '\n') # This exit code is replicated from avocado/core/exit_codes.py and not # imported because we are dealing with import failures sys.exit(-1)