Ошибка анализатора журнала в конструкторе ApplicationContextJAVA

Программисты JAVA общаются здесь
Anonymous
Ошибка анализатора журнала в конструкторе ApplicationContext

Сообщение Anonymous »

У меня есть требование реализовать структуру Spring в устаревшем приложении, чтобы дать ему больше структуры. Однако процесс прогона не может быть изменен (большая настройка, где необходимо адаптировать сотни заданий, если я коснутся того, как вызывается приложение). < /P>
Итак, программа запускается с Java -cp Program.jar Programmain -class_name "Script" ...
Основной метод программирования выглядит следующим образом:

Код: Выделить всё

public static void main(String[] args) {
try {
setEnvironmentVariables(args);
ApplicationContext context = new AnnotationConfigApplicationContext(EnvironmentConfiguration.class);
var className = context.getBean("className", String.class);
var executionScript = context.getBean(className, ScriptInterface.class);
System.out.println("Executing script");
executionScript.setup();
executionScript.run();
System.exit(0);
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
< /code>
Все работает, но ведение журнала выглядит так (сокращено, так как это много того же): < /p>
2025-02-17T13:38:44.732463534Z main ERROR Unrecognized format specifier [d]
2025-02-17T13:38:44.734027716Z main ERROR Unrecognized conversion specifier [d] starting at position 16 in conversion pattern.
2025-02-17T13:38:44.734713836Z main ERROR Unrecognized format specifier [thread]
2025-02-17T13:38:44.734788519Z main ERROR Unrecognized conversion specifier [thread] starting at position 25 in conversion pattern.
...
2025-02-17T13:38:44.742182084Z main ERROR Unrecognized format specifier [msg]
2025-02-17T13:38:44.742221296Z main ERROR Unrecognized conversion specifier [msg] starting at position 54 in conversion pattern.
2025-02-17T13:38:44.742265692Z main ERROR Unrecognized format specifier [n]
2025-02-17T13:38:44.742302840Z main ERROR Unrecognized conversion specifier [n] starting at position 56 in conversion pattern.
[main] INFO com.package.program.configuration.EnvironmentConfiguration - Setting up environment
< /code>
Последняя строка журнала находится в первой строке конструктора класса Environmentsfiguration. /p>
Соответствующие зависимости от дерева зависимости MVN: < /p>
[INFO] |  |  \- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.24.3:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.24.3:compile
[INFO] \- org.apache.logging.log4j:log4j-slf4j2-impl:jar:2.24.3:compile
[INFO] |  \- org.slf4j:jcl-over-slf4j:jar:1.7.10:compile
[INFO] +- org.slf4j:slf4j-api:jar:2.0.16:compile
[INFO] +- org.slf4j:slf4j-simple:jar:2.0.16:compile
< /code>
Так что у меня нет "нескольких версий одной и той же банки". Я понятия не имею, откуда берутся эти ошибки. Регистрация с помощью slf4j.logger в остальной части приложения работает нормально, и его правильно проанализировано (например: [main] info com.package.program.scripts.abstractscriptInterfaceimpl - Запуск testScript 

< P> Я играл с таким количеством комбинаций зависимостей. p>

Код: Выделить всё

ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
Я понятия не имею, как избавиться от этих ошибок, и любая идея ценится, спасибо.

Подробнее здесь: https://stackoverflow.com/questions/794 ... onstructor

Вернуться в «JAVA»