mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Merge branch '1294-log-stack-traces' into 'master'
Log exception stacktraces Closes #1294 See merge request akwizgran/briar!824
This commit is contained in:
@@ -42,6 +42,22 @@ public class BriefLogFormatter extends Formatter {
|
||||
tag = tag.substring(tag.lastIndexOf('.') + 1);
|
||||
sb.append(tag).append(": ");
|
||||
sb.append(record.getMessage());
|
||||
Throwable t = record.getThrown();
|
||||
if (t != null) {
|
||||
sb.append('\n');
|
||||
appendThrowable(sb, t);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private void appendThrowable(StringBuilder sb, Throwable t) {
|
||||
sb.append(t);
|
||||
for (StackTraceElement e : t.getStackTrace())
|
||||
sb.append("\n at ").append(e);
|
||||
Throwable cause = t.getCause();
|
||||
if (cause != null) {
|
||||
sb.append("\n Caused by: ");
|
||||
appendThrowable(sb, cause);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user