Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ protected Map<String, Object> toJsonMap(ILoggingEvent event) {
if(map.get(EXCEPTION) != null){
String maskedExceptionDetails = maskPSQLData(map.get(EXCEPTION).toString());
map.put(EXCEPTION, maskedExceptionDetails);
map.put("exceptionClass", event.getThrowableProxy().getCause().getClassName());
}
return map;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@
import io.dropwizard.logging.json.EventAttribute;
import io.dropwizard.logging.json.layout.JsonFormatter;
import io.dropwizard.logging.json.layout.TimestampFormatter;
import org.hibernate.exception.ConstraintViolationException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.slf4j.LoggerFactory;
import org.hibernate.exception.ConstraintViolationException;
import java.sql.SQLException;

import java.util.*;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
Expand Down Expand Up @@ -185,6 +188,7 @@ public void testPostgresMaskingOnException() {

Map<String, Object> map = dpcJsonLayout.toJsonMap(loggingEvent);
assertEquals(expectedLogMessage, map.get("exception"));
assertEquals(sqlException.getClass().getName(), map.get("exceptionClass"));
}

@Test
Expand Down
Loading