shichaoyuan opened a new issue, #13591:
URL: https://github.com/apache/skywalking/issues/13591

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Apache SkyWalking Component
   
   Java Agent (apache/skywalking-java)
   
   ### What happened
   
   The `replaceParam` method of `AbstractLogger` behaves unexpectedly when the 
replaced string contains a replacement marker.
   
   
   
   
   ### What you expected to happen
   
   ```
   log.info("sample rule update: {} -> {}", "Config{a={}}", "Config{b={}}")
   ```
   
   expect:  sample rule update: Config{a={}} -> Config{b={}}
   
   but actual: sample rule update: Config{a=Config{b={}}} -> {}
   
   ### How to reproduce
   
   just run code above
   
   ### Anything else
   
   
https://github.com/apache/skywalking-java/blob/67ab8b222fbb9a71b450665eb9f733380d813b8a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/logging/core/AbstractLogger.java#L185-L203
   
   
   ```
               tmpMessage = tmpMessage.replaceFirst("\\{\\}", 
Matcher.quoteReplacement(String.valueOf(parameters[parametersIndex++])));
               startSize = index + 2;
   ```
   
   The `index` should not just increase by 2, but should increase by the length 
of the string to be replaced.
   
   
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [x] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to