init: fix missing errors if logs didn't initialize (!1755)
Set the log level to DEBUG if args (and therefore logging) failed to initialize. This causes the default logging handler to be used, and everything that gets written to the log (error message and trace!) will get printed to stdout instead of not being printed anywhere at all. This can be tested by removing x86_64 from the mapping in pmb.parse.arch.alpine_native() (assuming the host is x86_64). Without this patch, no meaningful error appears. With the patch, the real error message, and a stack trace gets printed.
This commit is contained in:
parent
bda78e42ee
commit
69e2e22f58
|
@ -71,6 +71,10 @@ def main():
|
|||
logging.info("Done")
|
||||
|
||||
except Exception as e:
|
||||
# Dump log to stdout when args (and therefore logging) init failed
|
||||
if not args:
|
||||
logging.getLogger().setLevel(logging.DEBUG)
|
||||
|
||||
logging.info("ERROR: " + str(e))
|
||||
logging.info("See also: <https://postmarketos.org/troubleshooting>")
|
||||
logging.debug(traceback.format_exc())
|
||||
|
|
Loading…
Reference in New Issue