SLF4J не находит провайдера из logback-classic на vertxJAVA

Программисты JAVA общаются здесь
Ответить
Anonymous
 SLF4J не находит провайдера из logback-classic на vertx

Сообщение Anonymous »

Я пытаюсь добавить Logback в проект Vertx, но кажется, что SLF4J не видит logback, даже если он сам происходит из-за зависимости logback. Я использовал logback-classic зависимостей maven, который транзитивно импортирует slf4j-api и logback-core.
Когда я запускаю простой основной класс со случайным журналом, у меня возникает следующая ошибка:

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

SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
Мой pom.xml:

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

 & l t ; p r o j e c t   x m l n s = & q u o t ; h t t p : / / m a v e n . a p a c h e . o r g / P O M / 4 . 0 . 0 & q u o t ; < b r   / >           x m l n s : x s i = & q u o t ; h t t p : / / w w w . w 3 . o r g / 2 0 0 1 / X M L S c h e m a - i n s t a n c e & q u o t ; < b r   / >           x s i : s c h e m a L o c a t i o n = & q u o t ; h t t p : / / m a v e n . a p a c h e . o r g / P O M / 4 . 0 . 0   h t t p : / / m a v e n . a p a c h e . o r g / x s d / m a v e n - 4 . 0 . 0 . x s d & q u o t ; & g t ; < b r   / >     & l t ; m o d e l V e r s i o n & g t ; 4 . 0 . 0 & l t ; / m o d e l V e r s i o n & g t ; < b r   / > < b r   / >     & l t ; g r o u p I d & g t ; c o m . e x a m p l e & l t ; / g r o u p I d & g t ; < b r   / >     & l t ; a r t i f a c t I d & g t ; v e r t x - s t o c k - b r o k e r & l t ; / a r t i f a c t I d & g t ; < b r   / >     & l t ; v e r s i o n & g t ; 1 . 0 . 0 - S N A P S H O T & l t ; / v e r s i o n & g t ; < b r   / > < b r   / >     & l t ; p r o p e r t i e s & g t ; < b r   / >         & l t ; p r o j e c t . b u i l d . s o u r c e E n c o d i n g & g t ; U T F - 8 & l t ; / p r o j e c t . b u i l d . s o u r c e E n c o d i n g & g t ; < b r   / > < b r   / >         & l t ; m a v e n - c o m p i l e r - p l u g i n . v e r s i o n & g t ; 3 . 8 . 1 & l t ; / m a v e n - c o m p i l e r - p l u g i n . v e r s i o n & g t ; < b r   / >         & l t ; m a v e n - s h a d e - p l u g i n . v e r s i o n & g t ; 3 . 2 . 4 & l t ; / m a v e n - s h a d e - p l u g i n . v e r s i o n & g t ; < b r   / >         & l t ; m a v e n - s u r e f i r e - p l u g i n . v e r s i o n & g t ; 2 . 2 2 . 2 & l t ; / m a v e n - s u r e f i r e - p l u g i n . v e r s i o n & g t ; < b r   / >         & l t ; e x e c - m a v e n - p l u g i n . v e r s i o n & g t ; 3 . 0 . 0 & l t ; / e x e c - m a v e n - p l u g i n . v e r s i o n & g t ; < b r   / > < b r   / >         & l t ; v e r t x . v e r s i o n & g t ; 4 . 5 . 1 1 & l t ; / v e r t x . v e r s i o n & g t ; < b r   / >         & l t ; l o g b a c k - c l a s s i c . v e r s i o n & g t ; 1 . 5 . 1 2 & l t ; / l o g b a c k - c l a s s i c . v e r s i o n & g t ; < b r   / >         & l t ; j u n i t - j u p i t e r . v e r s i o n & g t ; 5 . 9 . 1 & l t ; / j u n it-jupiter.version>

com.example.vertx_stock_broker.MainVerticle
io.vertx.core.Launcher





io.vertx
vertx-stack-depchain
${vertx.version}
pom
import






io.vertx
vertx-web


ch.qos.logback
logback-classic
${logback-classic.version}



io.vertx
vertx-junit5
test


org.junit.jupiter
junit-jupiter-api
${junit-jupiter.version}
test


org.junit.jupiter
junit-jupiter-engine
${junit-jupiter.version}
test






maven-compiler-plugin
${maven-compiler-plugin.version}

17



maven-shade-plugin
${maven-shade-plugin.version}


package

shade





${launcher.class}
${main.verticle}




${project.build.directory}/${project.artifactId}-${project.version}-fat.jar






maven-surefire-plugin
${maven-surefire-plugin.version}


org.codehaus.mojo
exec-maven-plugin
${exec-maven-plugin.version}

${launcher.class}

run
${main.verticle}







Работающий класс:

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

package com.example.vertx_stock_broker;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Test {
private static final Logger LOG = LoggerFactory.getLogger(Test.class);

public static void main(String[] args)  {
LOG.debug("debug");
LOG.info("info");
LOG.error("error");
}
}
Я запускаю его с помощью инструмента запуска IntelliJ, который запускается автоматически (я сокращаю пути с помощью '...'):

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

openjdk-22.0.2\bin\java.exe "-javaagent:...\IntelliJ IDEA 2024.2.3\lib\idea_rt.jar=64366:...\IntelliJ IDEA 2024.2.3\bin"
-Dfile.encoding=UTF-8
-Dsun.stdout.encoding=UTF-8
-Dsun.stderr.encoding=UTF-8
-classpath ...\vertx-stock-broker\target\classes;
....m2\repository\io\vertx\vertx-web\4.5.11\vertx-web-4.5.11.jar;
....m2\repository\io\vertx\vertx-web-common\4.5.11\vertx-web-common-4.5.11.jar;
....m2\repository\io\vertx\vertx-auth-common\4.5.11\vertx-auth-common-4.5.11.jar;
....m2\repository\io\vertx\vertx-bridge-common\4.5.11\vertx-bridge-common-4.5.11.jar;
....m2\repository\io\vertx\vertx-core\4.5.11\vertx-core-4.5.11.jar;
....m2\repository\io\netty\netty-common\4.1.115.Final\netty-common-4.1.115.Final.jar;
....m2\repository\io\netty\netty-buffer\4.1.115.Final\netty-buffer-4.1.115.Final.jar;
....m2\repository\io\netty\netty-transport\4.1.115.Final\netty-transport-4.1.115.Final.jar;
....m2\repository\io\netty\netty-handler\4.1.115.Final\netty-handler-4.1.115.Final.jar;
....m2\repository\io\netty\netty-transport-native-unix-common\4.1.115.Final\netty-transport-native-unix-common-4.1.115.Final.jar;
....m2\repository\io\netty\netty-codec\4.1.115.Final\netty-codec-4.1.115.Final.jar;
....m2\repository\io\netty\netty-handler-proxy\4.1.115.Final\netty-handler-proxy-4.1.115.Final.jar;
....m2\repository\io\netty\netty-codec-socks\4.1.115.Final\netty-codec-socks-4.1.115.Final.jar;
....m2\repository\io\netty\netty-codec-http\4.1.115.Final\netty-codec-http-4.1.115.Final.jar;
....m2\repository\io\netty\netty-codec-http2\4.1.115.Final\netty-codec-http2-4.1.115.Final.jar;
....m2\repository\io\netty\netty-resolver\4.1.115.Final\netty-resolver-4.1.115.Final.jar;
....m2\repository\io\netty\netty-resolver-dns\4.1.115.Final\netty-resolver-dns-4.1.115.Final.jar;
....m2\repository\io\netty\netty-codec-dns\4.1.115.Final\netty-codec-dns-4.1.115.Final.jar;
....m2\repository\com\fasterxml\jackson\core\jackson-core\2.16.1\jackson-core-2.16.1.jar;
....m2\repository\ch\qos\logback\logback-core\1.5.12\logback-core-1.5.12.jar;
....m2\repository\org\slf4j\slf4j-api\2.0.7\slf4j-api-2.0.7.jar com.example.vertx_stock_broker.MainVerticle
Мой файл logback.xml:

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



%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n







Я не обнаружил конфликта или дублирования зависимостей. Используется OpenJdk22.
Я ожидаю получения журналов входа во время выполнения

Подробнее здесь: https://stackoverflow.com/questions/792 ... c-on-vertx
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

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