16

Logback で SLF4J の使用を開始したいと考えています。Logback のオンラインドキュメントを読み、JAR をリポジトリに追加して試してみる準備ができました。

But I'm at a loss! What JARs do I need? I downloaded that latest SLF4J (1.7.5) and expected to see something like slf4j-logback.jar, but don't see anything of the sorts. I've read that Logback contains a "native implementation" of SLF4J, but don't know exactly what this means, or if it also implies that I don't even need slf4j-api-1.7.5.jar on the classpath.

So I ask: to use the latest Logback (1.0.13), what JARs do I need? I took a look at the Maven central repo for logback 1.0.13 and don't see any dependencies listed, so that didn't help me at all. Thanks in advance!

4

1 に答える 1

33

pomにlogback-classicを追加する必要があります

    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.0.13</version>
    </dependency>

次の2つを推移的に追加します。

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-core</artifactId>
    <version>1.0.13</version>
</dependency>

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.5</version>
</dependency>

詳細については、 https://logback.qos.ch/setup.html#mavenBuildを参照してください。

于 2013-05-21T03:04:14.243 に答える