Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -140,8 +140,8 @@ public List<JobQueueBatchFile> processJobBatchPartial(UUID aggregatorID, IJobQue
final String failReasonLabel = failReason.map(Enum::name).orElse("NA");
stopWatch.stop();
String patientId = optPatient.isPresent() ? optPatient.get().getId() : "-1";
logger.info("dpcMetric=DataExportResult,PatientId={}, AggregatorId={}, dataRetrieved={},failReason={},duration={} , resourceFileSizes={}",
patientId, aggregatorID,failReason.isEmpty(), failReasonLabel, durationInSeconds,fileSize.get());
logger.info("dpcMetric=dataExportResult,patientId={},aggregatorId={},dataRetrieved={},failReason={},duration={},resourceFileSizes={}",
patientId, aggregatorID, failReason.isEmpty(), failReasonLabel, durationInSeconds, fileSize.get());
return results;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ private void logFetchDuration(Duration duration, int resourceCount, String fetch
loggingEventBuilder = logger.atInfo();
}

loggingEventBuilder.log("dpcMetric=ResourceFetched,resourceType={},fetchId={},durationSeconds={},resourceCount={}",
loggingEventBuilder.log("dpcMetric=resourceFetched,resourceType={},fetchId={},durationSeconds={},resourceCount={}",
resourceType.toString(), fetchId, seconds, resourceCount
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,9 @@ void loggerOutputContainsAllStructuredFields() {
// Verify log message format
// Verify log message format
String logMessage = testLogger.getLastLogMessage();
assertTrue(logMessage.contains("dpcMetric=DataExportResult"), "Log should contain metric name");
assertTrue(logMessage.contains("PatientId=" + patientIndex), "Log should contain patient index");
assertTrue(logMessage.contains("AggregatorId=" + aggregatorId), "Log should contain aggregator ID");
assertTrue(logMessage.contains("dpcMetric=dataExportResult"), "Log should contain metric name");
assertTrue(logMessage.contains("patientId=" + patientIndex), "Log should contain patient index");
assertTrue(logMessage.contains("aggregatorId=" + aggregatorId), "Log should contain aggregator ID");
assertTrue(logMessage.contains("dataRetrieved=true"), "Log should indicate data was retrieved");
assertTrue(logMessage.contains("failReason=NA"), "Log should show no failure");
assertTrue(logMessage.contains("resourceFileSizes="), "Log should contain resource sizes");
Expand Down
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