Fixed misleading expansion variable log message in ci.common - #532
Fixed misleading expansion variable log message in ci.common#532sajeerzeji wants to merge 4 commits into
Conversation
…alue instead of the full expression buffer by moving the log call inside the while loop.
| } | ||
| matcher.appendReplacement(sb, Matcher.quoteReplacement(finalReplacement)); | ||
| log.info(String.format("Resolving Property %s for expression %s. Resolved expression value is %s", varName , value , sb)); | ||
| log.info(String.format("Resolved environment variable \"%s\" in path \"%s\" to \"%s\"", varName, value, finalReplacement)); |
There was a problem hiding this comment.
Having this log message here with the replaced value for the variable is good, but to address the original issue I think you also need a single log message at the end showing what the complete replaced value is. My other comment was about how having a for loop for the variables at the end repeating the same complete value did not make sense. But having a single log message with the complete value would be valuable.
There was a problem hiding this comment.
Added one full line log at the end to show which one got replaced with what. Also shown the sample logs captured from my local in this comment #532 (comment)
There was a problem hiding this comment.
ci.maven and ci.gradle IT assertions are updated too.
|
Below are the logs captured in different scenarios Scenario 1: single variable Scenario 2: two variables combined Scenario 3: recursive NOTE: ${ROOT}/semeru appears twice because it's resolved once for JDK and again when resolving JAVA_HOME_DERIVED through JDK |
| } | ||
| matcher.appendReplacement(sb, Matcher.quoteReplacement(finalReplacement)); | ||
| log.info(String.format("Resolving Property %s for expression %s. Resolved expression value is %s", varName , value , sb)); | ||
| log.info(String.format("Resolved environment variable \"%s\" in path \"%s\" to \"%s\"", varName, value, finalReplacement)); |
Fixes OpenLiberty/ci.maven#2076
Reference: OpenLiberty/ci.maven#2076 (comment)
Moved the log call to after the full string is assembled, so the complete resolved path is shown, and updates the message format to clearly state which variable was expanded, the original expression it appeared in, and the fully resolved result. The corresponding IT assertions in ci.maven and ci.gradle are updated to match the new message format.