-
Notifications
You must be signed in to change notification settings - Fork 325
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
feat: log stacktrace #3418
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,8 @@ | |
import com.google.cloud.spring.pubsub.support.GcpPubSubHeaders; | ||
import com.google.cloud.spring.pubsub.support.converter.ConvertedBasicAcknowledgeablePubsubMessage; | ||
import com.google.pubsub.v1.ProjectSubscriptionName; | ||
import java.io.PrintWriter; | ||
import java.io.StringWriter; | ||
import java.util.Map; | ||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
|
@@ -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)); | ||
LOGGER.warn(stringWriter.toString()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, thanks, I wasn't aware there's a |
||
} | ||
|
||
private void addToHealthRegistry() { | ||
|
There was a problem hiding this comment.
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.