Skip to content

Commit

Permalink
0004375: GSON parsing fails for logging stack traces
Browse files Browse the repository at this point in the history
  • Loading branch information
jumpmind-josh committed Apr 28, 2020
1 parent a84d4a6 commit b4c2196
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Expand Up @@ -75,7 +75,7 @@ public MonitorEvent check(Monitor monitor) {
protected String serializeDetails(List<LogSummary> logs) {
String result = null;
try {
GsonBuilder builder = new GsonBuilder();
GsonBuilder builder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
builder.addSerializationExclusionStrategy(new SuperClassExclusion());
builder.addDeserializationExclusionStrategy(new SuperClassExclusion());
result = builder.create().toJson(logs);
Expand Down
10 changes: 10 additions & 0 deletions symmetric-util/src/main/java/org/jumpmind/util/LogSummary.java
Expand Up @@ -25,25 +25,35 @@

import org.apache.log4j.Level;

import com.google.gson.annotations.Expose;

public class LogSummary implements Comparable<LogSummary> {


@Expose
private Level level;

@Expose
private String mostRecentThreadName;

private Throwable throwable;

@Expose
private long firstOccurranceTime;

@Expose
private long mostRecentTime;

@Expose
private int count;

@Expose
private String message;

@Expose
private String stackTrace;

@Expose
private Integer levelInt;

public void setLevel(Level level) {
Expand Down

0 comments on commit b4c2196

Please sign in to comment.