Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: log stacktrace #3418

Merged
merged 5 commits into from
Dec 16, 2024
Merged

feat: log stacktrace #3418

merged 5 commits into from
Dec 16, 2024

Conversation

JoeWang1127
Copy link
Contributor

Fix: #3402

@JoeWang1127 JoeWang1127 requested a review from a team as a code owner December 13, 2024 23:18
@JoeWang1127 JoeWang1127 marked this pull request as draft December 13, 2024 23:47
@JoeWang1127
Copy link
Contributor Author

Native tests failed:

Error: Classes that should be initialized at run time got initialized during image building:
 com.google.protobuf.RuntimeVersion was unintentionally initialized at build time. To see why com.google.protobuf.RuntimeVersion got initialized use --trace-class-initialization=com.google.protobuf.RuntimeVersion
To see how the classes got initialized, use --trace-class-initialization=com.google.protobuf.RuntimeVersion

This is irrelevant to this feature.

@JoeWang1127 JoeWang1127 marked this pull request as ready for review December 16, 2024 15:47
@@ -179,6 +181,10 @@ private void logWarning(
} else {
LOGGER.warn(re.getMessage());
}
// Log the stacktrace for troubleshoot.
StringWriter stringWriter = new StringWriter();
re.printStackTrace(new PrintWriter(stringWriter));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not threadsafe -- we probably don't want this here. Logging is the goal.

// Log the stacktrace for troubleshoot.
StringWriter stringWriter = new StringWriter();
re.printStackTrace(new PrintWriter(stringWriter));
LOGGER.warn(stringWriter.toString());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would duplicate the log entry since we're already sending a log above. Can we adjust the log messages above, instead? For example, LOGGER.warn("Message", exception)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks, I wasn't aware there's a LOGGER.warn(String, Exception) method.

@JoeWang1127 JoeWang1127 merged commit cebcbed into main Dec 16, 2024
52 of 77 checks passed
@JoeWang1127 JoeWang1127 deleted the feat/emit-exception branch December 16, 2024 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide better error information in PubSubInboundChannelAdapter
2 participants