[logging] `sys` was not imported so sys.stdout.write didn't work and there was an except which prevent the exception to kick in