Skip to content

Instantly share code, notes, and snippets.

View shai-almog's full-sized avatar

Shai Almog shai-almog

View GitHub Profile
@shai-almog
shai-almog / StackToHash.java
Created September 14, 2021 11:07
Convert the current stack to a checksum hex string which we can use in logs to identify call stack differences
public class DebugUtil {
public static String stackHash() {
try {
// code from https://www.baeldung.com/java-stacktrace-to-string
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
new RuntimeException().printStackTrace(pw);
// checksuming for speed
int sum = 0;