Skip to content

Instantly share code, notes, and snippets.

@rkhmelyuk
Created February 21, 2017 05:42
Show Gist options
  • Save rkhmelyuk/4c35eb9577d95e044b65b781ab87815e to your computer and use it in GitHub Desktop.
Save rkhmelyuk/4c35eb9577d95e044b65b781ab87815e to your computer and use it in GitHub Desktop.
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