Skip to content

Instantly share code, notes, and snippets.

@davidawad
Created February 9, 2021 19:13
Show Gist options
  • Save davidawad/3cf1cd8608761179ff1af643eaa7922b to your computer and use it in GitHub Desktop.
Save davidawad/3cf1cd8608761179ff1af643eaa7922b to your computer and use it in GitHub Desktop.
example usage of custom logging in corda
Logger logger = LoggerFactory.getLogger("net.corda"); // note this logger's name is specified in the xml config
Party me = getOurIdentity();
// we have an opportunity to log out the contents of the flow arguments.
ThreadContext.put("initiator", me.getName().toString());
ThreadContext.put("target", target.getName().toString());
// publish to the log with the additional context
logger.info("Initializing the transaction.");
// flush the threadContext of these additional properties
ThreadContext.removeAll(Arrays.asList("initiator", "target"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment