-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Fix incorrect variable placeholder for Strings.format calls #91531
Conversation
The curly bracket placeholder works for LoggerMessageFormat.format and ParameterizedMessage.format, but Not for Strings.format which requires Java's string format syntax. This PR fixes the incorrect usages.
Pinging @elastic/es-core-infra (Team:Core/Infra) |
@pgomulka We have choice to use either of the following four static
The first two support |
@ywangd thank you for fixing this. Ideally we should use org.elasticsearch.core.Strings.format. Do you think you could also change the imports? Agree we need some static analysis tool to fix the incorrect usages of logger formatting. Unfortunately ESLoggerUsageChecker does not check this at the moment. I have this on a list as a possible refactoring during the tech debt week. |
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.
Thank you for fixing this!
I think replacing static imports i.e., format()
with Strings.format(...)
would be nice (I think this is what @pgomulka is also suggesting).
@pgomulka All usages of the
It's great to know this is on your (team)'s radar. If we don't want use |
@ywangd appologies, I noticed the String.format usage in JavaModulePrecommitTask and I thought that this PR has a mixture of different .format methods. All is good. thanks |
* main: (163 commits) [DOCS] Edits frequent items aggregation (elastic#91564) Handle providers of optional services in ubermodule classloader (elastic#91217) Add `exportDockerImages` lifecycle task for exporting docker tarballs (elastic#91571) Fix CSV dependency report output file location in DRA CI job Fix variable placeholder for Strings.format calls (elastic#91531) Fix output dir creation in ConcatFileTask (elastic#91568) Fix declaration of dependencies in DRA snapshots CI job (elastic#91569) Upgrade Gradle Enterprise plugin to 3.11.4 (elastic#91435) Ingest DateProcessor (small) speedup, optimize collections code in DateFormatter.forPattern (elastic#91521) Fix inter project handling of generateDependenciesReport (elastic#91555) [Synthetics] Add synthetics-* read to fleet-server (elastic#91391) [ML] Copy more settings when creating DF analytics destination index (elastic#91546) Reduce CartesianCentroidIT flakiness (elastic#91553) Propagate last node to reinitialized routing tables (elastic#91549) Forecast write load during rollovers (elastic#91425) [DOCS] Warn about potential overhead of named queries (elastic#91512) Datastream unavailable exception metadata (elastic#91461) Generate docker images and dependency report in DRA ci job (elastic#91545) Support cartesian_bounds aggregation on point and shape (elastic#91298) Add support for EQL samples queries (elastic#91312) ... # Conflicts: # x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/RollupShardIndexer.java
The curly bracket placeholder works for LoggerMessageFormat.format and ParameterizedMessage.format, but Not for Strings.format which requires Java's string format syntax. This PR fixes the incorrect usages.
Relates: #86549, #87924
PS: I labelled this
>non-issue
because the changes are all for debug/trace level loggings.