Merge branch 'fix_logging' into 'master'

Ignore encoding errors in logs

See merge request fdroid/fdroidserver!1394
This commit is contained in:
Hans-Christoph Steiner 2023-10-10 07:16:15 +00:00
commit 113bf3a769

View file

@ -250,13 +250,13 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
line = cmd_stdout.readline() line = cmd_stdout.readline()
if line: if line:
if options.verbose: if options.verbose:
logging.debug("buildserver > " + str(line, 'utf-8').rstrip()) logging.debug("buildserver > " + str(line, 'utf-8', 'replace').rstrip())
output += line output += line
else: else:
time.sleep(0.05) time.sleep(0.05)
for line in cmd_stdout.readlines(): for line in cmd_stdout.readlines():
if options.verbose: if options.verbose:
logging.debug("buildserver > " + str(line, 'utf-8').rstrip()) logging.debug("buildserver > " + str(line, 'utf-8', 'replace').rstrip())
output += line output += line
finally: finally:
cmd_stdout.close() cmd_stdout.close()
@ -270,7 +270,7 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
else: else:
message = "Build.py failed on server for {0}:{1}" message = "Build.py failed on server for {0}:{1}"
raise BuildException(message.format(app.id, build.versionName), raise BuildException(message.format(app.id, build.versionName),
str(output, 'utf-8')) str(output, 'utf-8', 'replace'))
# Retreive logs... # Retreive logs...
toolsversion_log = common.get_toolsversion_logname(app, build) toolsversion_log = common.get_toolsversion_logname(app, build)
@ -296,7 +296,7 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
except Exception as exc: except Exception as exc:
raise BuildException( raise BuildException(
"Build failed for {0}:{1} - missing output files".format( "Build failed for {0}:{1} - missing output files".format(
app.id, build.versionName), str(output, 'utf-8')) from exc app.id, build.versionName), str(output, 'utf-8', 'replace')) from exc
ftp.close() ftp.close()
finally: finally: