Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Make Android logcat logging ignore single '\n' log line.
  • Loading branch information
lateralusX committed Mar 21, 2025
commit 0d2a29ee69079ea5221d3edf5c48cd53703f3d09
21 changes: 7 additions & 14 deletions src/coreclr/vm/eepolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,41 +373,34 @@ void LogInfoForFatalError(UINT exitCode, LPCWSTR pszMessage, PEXCEPTION_POINTERS

EX_TRY
{
StackSString message;
if (exitCode == (UINT)COR_E_FAILFAST)
{
message.Append(W("Process terminated. "));
PrintToStdErrA("Process terminated.\n");
}
else
{
message.Append(W("Fatal error. "));
PrintToStdErrA("Fatal error.\n");
}

if (errorSource != NULL)
{
message.Append(errorSource);
message.Append(W("\n"));

PrintToStdErrW(message.GetUnicode());

message.Clear();
PrintToStdErrW(errorSource);
PrintToStdErrA("\n");
}

if (pszMessage != NULL)
{
message.Append(pszMessage);
PrintToStdErrW(pszMessage);
}
else
{
// If no message was passed in, generate it from the exitCode
InlineSString<256> exitCodeMessage;
GetHRMsg(exitCode, exitCodeMessage);
message.Append(exitCodeMessage);
PrintToStdErrW(exitCodeMessage.GetUnicode());
}

message.Append(W("\n"));

PrintToStdErrW(message.GetUnicode());
PrintToStdErrA("\n");

Thread* pThread = GetThreadNULLOk();
if (pThread && errorSource == NULL)
Expand Down
3 changes: 3 additions & 0 deletions src/native/minipal/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ static int android_log_flag(minipal_log_flags flags)

static size_t log_write(minipal_log_flags flags, const char* msg, size_t msg_len)
{
if (msg_len == 1 && msg[0] == '\n')
return 0;

return __android_log_write(android_log_flag(flags), MINIPAL_LOG_RUNTIME_TAG, msg) == 1 ? msg_len : 0;
}

Expand Down
Loading