Skip to content

Instantly share code, notes, and snippets.

@rkhmelyuk
Created February 21, 2017 05:42
final AggregatedLogData logData = new AggregatedLogData();
logData.setLevel(AggregatedLogLevel.FULL);
boolean error = false;
try {
// .. execute code here
} catch (Exception e) {
logData.collectException("Failed to process rules", e);
error = true;
} finally {
if (error) {
logData.setLevel(AggregatedLogLevel.EXHAUSTIVE); // print all on error
log.error(logData.toJsonString());
} else {
log.info(logData.toJsonString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment