Skip to content

Commit

Permalink
Gh-2994: Make gremlin logging configurable (#3180)
Browse files Browse the repository at this point in the history
* only show info logs if they are enabled

* move check and fix formatting

* change info to debug
  • Loading branch information
cn337131 committed Apr 8, 2024
1 parent b294275 commit fe1d93a
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -638,21 +638,20 @@ public <T> T execute(final OperationChain<T> opChain) {
for (final Operation operation : opChain.getOperations()) {
operation.setOptions(opOptions);

if (operation instanceof Input) {
if (LOGGER.isDebugEnabled() && operation instanceof Input) {
Object input = ((Input) operation).getInput();
if (input != null) {
if (input instanceof MappedIterable) {
((MappedIterable) input).forEach(item -> { LOGGER.info("GafferPop operation input: " + item.toString()); });
} else {
LOGGER.info("GafferPop operation input: " + input.toString());
}
if (input instanceof MappedIterable) {
((MappedIterable) input).forEach(item -> {
LOGGER.debug("GafferPop operation input: {}", item);
});
} else {
LOGGER.debug("GafferPop operation input: {}", input);
}
}

}

try {
LOGGER.info("GafferPop operation chain called: " + opChain.toString());
LOGGER.info("GafferPop operation chain called: {}", opChain.toOverviewString());
return graph.execute(opChain, user);
} catch (final Exception e) {
LOGGER.error("Operation chain failed: " + e.getMessage(), e);
Expand Down

0 comments on commit fe1d93a

Please sign in to comment.