vimterd
vimterd

Reputation: 311

Logback configuration file is ignored

The logback's configuration file is ignored into my WS module (I'm using glassfish). The location .../src/main/resources/logback.xml

This is its content:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <!-- encoders are assigned the type
    ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
    <encoder>
        <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
    </encoder>
</appender>

<root level="trace">
    <appender-ref ref="STDOUT" />
</root>
</configuration>

I start the WS service with the command mvn embedded-glassfish:run

Any suggestions?

Upvotes: 2

Views: 4119

Answers (1)

Evan Siroky
Evan Siroky

Reputation: 9408

I had a similar issue that was occurring because I was filtering out the logback.xml file in the maven build process. I had to add an entry back in for the logback.xml file and then it worked:

<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
            <includes>
                <include>logback.xml</include>
                ...
            </includes>
        </resource>
    </resources>
    ...
</build>

Upvotes: 2

Related Questions