Skip to content

Commit ca619ef

Browse files
Restore logging for android commands with proper truncation (#4411)
When logging directly to GCP we were not using the specific stackdriver log limit, that might've been the issue causing log-too long errors? In that case this should fix this + reenable those logs This is somewhat reverting /pull/4021
1 parent 69e67de commit ca619ef

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/clusterfuzz/_internal/metrics/logs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,12 +545,15 @@ def emit(level, message, exc_info=None, **extras):
545545

546546
_add_appengine_trace(all_extras)
547547

548+
log_limit = STACKDRIVER_LOG_MESSAGE_LIMIT if _cloud_logging_enabled(
549+
) else LOCAL_LOG_MESSAGE_LIMIT
550+
548551
# We need to make a dict out of it because member of the dict becomes the
549552
# first class attributes of LogEntry. It is very tricky to identify the extra
550553
# attributes. Therefore, we wrap extra fields under the attribute 'extras'.
551554
logger.log(
552555
level,
553-
truncate(message, LOCAL_LOG_MESSAGE_LIMIT),
556+
truncate(message, log_limit),
554557
exc_info=exc_info,
555558
extra={
556559
'extras': all_extras,

src/clusterfuzz/_internal/platforms/android/adb.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,9 @@ def run_command(cmd, log_output=False, timeout=None, recover=True):
697697
wait_until_fully_booted()
698698
output = execute_command(get_adb_command_line(cmd), timeout)
699699

700+
if log_output:
701+
logs.info('Output: (%s)' % output)
702+
700703
return output
701704

702705

0 commit comments

Comments
 (0)