Как иметь один и тот же журнал slf4j с JDK8 и JDK11?
Мой регистратор java Slf4j:
log.info("---> {} {}", "When", String.format(matcher.group(1).replaceAll("\\{\\S+\\}", "{%s}").replace("(\\?)", ""), invocation.getArguments()));
Моя трассировка в java 8 от JDK8:
---> When I update text {bakery.DemoPage-input_text_field} with {Jenkins T5}
Моя трассировка в java 8 от JDK11:
---> When "I update text {bakery.DemoPage-input_text_field} with {Jenkins T5}"
ИЗМЕНИТЬ:
Я пробую это, но тот же результат:
String message = MessageFormat.format("---> {0} {1}",
stepAnnotation.annotationType().getSimpleName(),
String.format(matcher.group(1).replaceAll("\\{\\S+\\}", "{%s}").replace("(\\?)", ""), invocation.getArguments())
);
log.info(message);
ИЗМЕНИТЬ (если вам нужен более простой вариант):
log.info("---> {} {}", "When", String.format("I update text {%s} with {%s}", "bakery.DemoPage-input_text_field", "Jenkins T5"));
ИЗМЕНИТЬ с помощью @M. Предложение Deinum но не работает
log.info("---> {} " + matcher.group(1).replaceAll("\\{\\S+\\}", "{}").replace("(\\?)", ""), stepAnnotation.annotationType().getSimpleName(), invocation.getArguments());
---> When "I update text [bakery.DemoPage-input_text_field, Jenkins T5, []] with {}"
РЕДАКТИРОВАТЬ: я пробую другое предложение с внешней заменой:
String mes = String.format(matcher.group(1).replaceAll("\\{\\S+\\}", "{%s}").replace("(\\?)", ""), invocation.getArguments());
log.info("---> {} {}", stepAnnotation.annotationType().getSimpleName(), mes);
---> When "I update text {bakery.DemoPage-input_text_field} with {Jenkins T5}"
"I update text {string} with {string}(\\?)"
- person Stéphane GRILLON   schedule 12.03.2020slf4j
, а изjava.lang.annotation.Annotation.toString()
разных в JDK8 и JDK11:@io.cucumber.java.en.When(timeout=0, value=I update text {string} with {string}(\?))
и@io.cucumber.java.en.When(timeout=0, value="@io.cucumber.java.en.When(timeout=0, value="I update text {string} with {string}(\?)")
- person Stéphane GRILLON   schedule 12.03.2020