Как вести один и тот же журнал slf4j с JDK8 и JDK11?
My java Slf4j logger:
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}"