Skip to content

Commit 0bcf102

Browse files
committed
Enable logging.
1 parent 91d4bb8 commit 0bcf102

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

ci/fireci/fireci/emulator.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def __init__(
5656
self._stdout = self._open(log_dir, 'stdout.log')
5757
self._stderr = self._open(log_dir, 'stderr.log')
5858
self._adb_log = self._open(log_dir, 'logcat.log')
59+
self._log_dir = log_dir
5960
self._name = name
6061

6162
self._emulator_binary = emulator_binary
@@ -93,12 +94,12 @@ def __exit__(self, exception_type, exception_value, traceback):
9394
self._kill(self._logcat)
9495
self._close_files()
9596

96-
def _open(self, dirname, filename):
97+
def _open(self, dirname, filename, mode='w'):
9798
"""Opens a file in a given directory, creates directory if required."""
9899
dirname = os.path.join(self._artifacts_dir, dirname)
99100
if (not os.path.exists(dirname)):
100101
os.makedirs(dirname)
101-
return open(os.path.join(dirname, filename), 'w')
102+
return open(os.path.join(dirname, filename), mode)
102103

103104
def _wait_for_boot(self, timeout: datetime.timedelta):
104105
_logger.info('Waiting for avd to boot...')
@@ -124,6 +125,10 @@ def _wait_for_boot(self, timeout: datetime.timedelta):
124125
self._kill(wait, sig=signal.SIGKILL)
125126
raise RuntimeError("Emulator startup timed out.")
126127

128+
with self._open(self._log_dir, 'stderr.log', mode='r') as stderr:
129+
_logger.error('Emulator failed with exit code {}\n {}'.format(
130+
self._process.returncode, stderr.read()))
131+
127132
self._kill(wait)
128133
raise RuntimeError(
129134
"Emulator failed to launch. See emulator logs for details.")

ci/fireci/tests/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,3 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
15-
import logging
16-
17-
logging.disable(logging.CRITICAL)

0 commit comments

Comments
 (0)