New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CAMEL-12004 Add isDebugEnabled() guard for debug level logs #2093
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,7 +131,9 @@ protected AbstractMessageListenerContainer createListenerContainer() throws Exce | |
answer = new SharedQueueMessageListenerContainer(endpoint, fixedMessageSelector); | ||
// must use cache level consumer for fixed message selector | ||
answer.setCacheLevel(DefaultMessageListenerContainer.CACHE_CONSUMER); | ||
log.debug("Using shared queue: " + endpoint.getReplyTo() + " with fixed message selector [" + fixedMessageSelector + "] as reply listener: " + answer); | ||
if (log.isDebugEnabled()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could use |
||
log.debug("Using shared queue: " + endpoint.getReplyTo() + " with fixed message selector [" + fixedMessageSelector + "] as reply listener: " + answer); | ||
} | ||
} else { | ||
// use a dynamic message selector which will select the message we want to receive as reply | ||
dynamicMessageSelector = new MessageSelectorCreator(correlation); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,7 +154,7 @@ protected void processInTransaction(final Exchange exchange) throws Exception { | |
if (log.isDebugEnabled()) { | ||
// log exception if there was a cause exception so we have the stack trace | ||
Exception cause = exchange.getException(); | ||
if (cause != null) { | ||
if (cause != null && log.isDebugEnabled()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. log debug enable is already checked above |
||
log.debug("Transaction rollback (" + transactionKey + ") redelivered(" + redelivered + ") for " | ||
+ ids + " due exchange was marked for rollbackOnlyLast and caught: ", cause); | ||
} else { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,8 +85,9 @@ protected void assertExpression(String expressionText, String expectedValue, Str | |
} else { | ||
value = expression.evaluate(exchange, Object.class); | ||
} | ||
|
||
log.debug("Evaluated expression: " + expression + " on exchange: " + exchange + " result: " + value); | ||
if (log.isDebugEnabled()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The rest is just unit tests and tooling so its not as important as runtime camel-core etc. However the changes are fine to do, but maybe favor using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general, you do not recommend increasing complexity with the if statement. right? |
||
log.debug("Evaluated expression: " + expression + " on exchange: " + exchange + " result: " + value); | ||
} | ||
|
||
assertTrue("Expression: " + expression + " on Exchange: " + exchange, | ||
expectedValue.equals(value) || orThisExpectedValue.equals(value)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed when using {}