-
Notifications
You must be signed in to change notification settings - Fork 683
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
GEODE-6588: Fixed mismatch of placeholders and arguments #7375
Conversation
3e5363d
to
aa49263
Compare
...core/src/distributedTest/java/org/apache/geode/internal/jta/dunit/LoginTimeOutDUnitTest.java
Show resolved
Hide resolved
geode-core/src/main/java/org/apache/geode/cache/client/internal/QueueStateImpl.java
Show resolved
Hide resolved
@@ -328,8 +328,8 @@ protected void basicPerformTimeout(boolean isPending) throws CacheException { | |||
if (logger.isTraceEnabled()) { | |||
// NOTE: original finer message used this.toString() twice |
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.
I don't this comment is necessary anymore.
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.
will remove
@@ -1257,7 +1257,7 @@ boolean canAccommodateMoreBytesSafely(int bytes) { | |||
final long curBytes = bytesInUse.get(); | |||
if (isDebugEnabled) { | |||
logger.debug( | |||
"canAccomodateMoreBytes: bytes = {} allocatedMemory = {} newAllocatedSize = {} thresholdSize = ", | |||
"canAccomodateMoreBytes: bytes ={} allocatedMemory ={} newAllocatedSize ={} thresholdSize ={}", |
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.
Was it intentional to remove the whitespace here?
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.
was trying to keep the spacing unform in a way. There are no spaces in ':{}' (sometimes they do) hence was trying to keep things uniform.
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.
If removing whitespace, x=5 y=7
seems more natural than x =5 y =7
🤷♂️
@@ -3022,7 +3022,7 @@ public void handleInterestEvent(InterestRegistrationEvent event) { | |||
// If this is a registration event, add interest for this key | |||
if (isRegister) { | |||
if (logger.isDebugEnabled()) { | |||
logger.debug("PartitionedRegionDataStore for {} adding interest for: ", | |||
logger.debug("PartitionedRegionDataStore for {} adding interest for :{}", |
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.
Whitespace change seems wrong.
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.
if we search for :{} in the project, we see that it is being used. I remember all logs I analyzed in hydra we used this format. Helps in easier greps
@@ -462,7 +462,7 @@ public static void send(InternalDistributedMember recipient, int processorId, | |||
if (exception != null) { | |||
m.setException(exception); | |||
if (logger.isDebugEnabled()) { | |||
logger.debug("Replying with exception: {}" + m, exception); | |||
logger.debug("Replying with exception:{}", m, exception); |
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.
I wonder if the intent was for just the exception message here and not the stack.
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.
I think it is safe as it is inside debug flag
@@ -98,7 +98,7 @@ public synchronized void lastResult(Object oneResult) { | |||
} | |||
|
|||
if (logger.isDebugEnabled()) { | |||
logger.debug("ServerToClientFunctionResultSender sending last result1 {} " + oneResult); | |||
logger.debug("ServerToClientFunctionResultSender sending last result1 {} ", oneResult); |
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.
Trailing whitespace.
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.
will fix
logger.warn("Unable to schedule background cleanup of transactions for departed member {}." | ||
+ " Performing in-line cleanup of the transactions."); | ||
logger.warn( | ||
"Unable to schedule background cleanup of transactions for departed member. Performing in-line cleanup of the transactions."); |
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.
Is there a member to log here?
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.
found it. adding it to the log
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.
I think you accidentally picked up all of the places where we are trying to log the full stack of an exception.
For example - this was correct and will log the full stack trace
logger.debug("I saw an exception", e)
But you changed many of these to this, which will lose the whole stack trace:
logger.debug("I saw an exception {}", e)
aa49263
to
2804752
Compare
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.
Sorry Naba - I was reading those messages backwards.
b62b83f
to
8dbc866
Compare
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.
comment deleted
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.
I had a few comments for you to consider but didn't see anything that had to be changed. It does seem like a common theme is confusion about the last parameter and if it should be logged as an exception stack or just part of the message. It seems like our use of the log4j Logger interface would make it hard to cleanup this ambiguity.
@@ -5126,8 +5126,8 @@ public static void validatePRID(InternalDistributedMember sender, int prId, Stri | |||
PartitionedRegion pr = (PartitionedRegion) o; | |||
if (pr.getPRId() == prId) { | |||
if (!pr.getRegionIdentifier().equals(regionId)) { | |||
logger.warn("{} is using PRID {} for {} but this process maps that PRID to {}", | |||
new Object[] {sender.toString(), prId, pr.getRegionIdentifier()}); | |||
logger.warn("{} is using PRID {} for regionId {} but this process maps that PRID to {}", |
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.
could "sender.toString()" just be "sender"? This will improve performance if warnings are disabled (which is unlikely).
@@ -5613,7 +5613,7 @@ public void cleanupFailedInitialization() { | |||
} | |||
if (savedFirstRuntimeException != null | |||
&& savedFirstRuntimeException instanceof DistributedSystemDisconnectedException) { | |||
logger.warn("cleanupFailedInitialization originally failed with {}", | |||
logger.warn("cleanupFailedInitialization originally failed with: ", |
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.
Did the old code for this warning log the call stack for savedFirstRuntimeException? It looks like the intent was just to log savedFirstRuntimeException.toString() inside the curly brackets.
But if the old behavior was to log the stack then I think your change is good.
All the places we consider setting savedFirstRuntimeException we also log a warning with the full stack. So I think that intent of this message was just to say "cleanup actually did fail and here is the exception of all the ones we already logged that caused the failure". It seems odd to me that these are warnings. I'm not sure what a customer could do with these warnings.
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.
I like having the stack on warnings.
@@ -72,7 +72,7 @@ public void cmdExecute(final @NotNull Message clientMessage, | |||
String regionName = regionNamePart.getCachedString(); | |||
|
|||
if (regionName == null) { | |||
logger.warn("The input region name for the %s request is null", "size"); | |||
logger.warn("The input region name for the size request is null"); |
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.
while you are in this part of the code consider fixing the errMessage.append call also. It seems like we should just have a local String constant that is in both calls.
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.
Done with #7399
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.
A couple minor comments.
@@ -5613,7 +5613,7 @@ public void cleanupFailedInitialization() { | |||
} | |||
if (savedFirstRuntimeException != null | |||
&& savedFirstRuntimeException instanceof DistributedSystemDisconnectedException) { | |||
logger.warn("cleanupFailedInitialization originally failed with {}", | |||
logger.warn("cleanupFailedInitialization originally failed with: ", |
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.
I like having the stack on warnings.
@@ -2953,7 +2953,7 @@ public void executeOnDataStore(final Set localKeys, final Function function, fin | |||
long start = stats.startFunctionExecution(function.hasResult()); | |||
try { | |||
if (logger.isDebugEnabled()) { | |||
logger.debug("Executing Function: {} on Remote Node with context: ", function.getId(), | |||
logger.debug("Executing Function:{} on Remote Node with context: {}", function.getId(), |
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.
The space was removed in Function:{}
. It probably should also be removed in context: {}
@@ -146,7 +146,7 @@ private void initializeEventSeqNumQueue() { | |||
|
|||
if (logger.isDebugEnabled()) { | |||
logger.debug( | |||
"For bucket {} ,total keys recovered are : {} last key recovered is : {} and the seqNo is ", | |||
"For bucket: {} ,total keys recovered are: {} last key recovered is: {} and the seqNo is: {}", |
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: {} ,
should be this: {},
. Also there are no commas in the rest of that message, so maybe the comma should be removed altogether.
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.
I recommend some minor changes.
@@ -393,7 +393,7 @@ public static void send(InternalDistributedMember recipient, int processorId, | |||
if (exception != null) { | |||
m.setException(exception); | |||
if (logger.isDebugEnabled()) { | |||
logger.debug("Replying with exception: {}" + m, exception); | |||
logger.debug("Replying with exception: {}", m, exception); |
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.
Missing {}
here.
@@ -462,7 +462,7 @@ public static void send(InternalDistributedMember recipient, int processorId, | |||
if (exception != null) { | |||
m.setException(exception); | |||
if (logger.isDebugEnabled()) { | |||
logger.debug("Replying with exception: {}" + m, exception); | |||
logger.debug("Replying with exception: {}", m, exception); |
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.
Missing {}
here.
logger.trace( | ||
"{}.performTimeout().getExpirationTime() is {}; {}.expire({}). ttlExpiration: {}, idleExpiration: {}, ttlAttrs: {}, idleAttrs: {} action is: {}", | ||
this, expTime, this, action, ttl, idle, getTTLAttributes(), getIdleAttributes()); | ||
"{}.performTimeout().getExpirationTime() is {}; ttlExpiration:{}, idleExpiration:{}, ttlAttrs:{}, idleAttrs:{} action is:{}", |
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 passed as parameter for {}.performTimeout().getExpirationTime()
. It will call EntryExpiryTask.toString()
which returns a long string description with spaces. It is not easy to read. Perhaps passing this.getClass().getSimpleName()
would be better. And the method name should be basicPerformTimeout
instead of performTimeout()
.
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.
I reviewed the changes in files for which I'm code-owner. Those look perfect. Thanks for the changes @nabarunnag !
8dbc866
to
f257f65
Compare
@boglesby I made sure that stacktrace is always printed in these changes |
arguments were fixed in this PR.
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?
Has your PR been rebased against the latest commit within the target branch (typically
develop
)?Is your initial contribution a single, squashed commit?
Does
gradlew build
run cleanly?Have you written or updated unit tests to verify your changes?
If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?