I want to use logback logging with maven-jetty-plugin. Apparently, the system property logback.configurationFile is read after maven-jetty-plugin is started and slf4j is initialized, therefore the file. /src/test/resources/logback.xml the berth cannot be read. As a result, I get all log messages configured to the debug level and printed to the console (the default configuration for the log). Running maven with -Dlogback.configurationFile = ... fixes the problem. However, I would prefer to set the property to pom, as is possible with log4j and maven-jetty-plugin. Any ideas?
Here is my pom.xml:
... <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>8.0.4.v20111024</version> <dependencies> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.0.0</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.6.1</version> </dependency> </dependencies> <configuration> <systemProperties> <systemProperty> <name>logback.configurationFile</name> <value>./src/test/resources/logback.xml</value> </systemProperty> </systemProperties> ...
And here is logback.xml:
<configuration> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>logFile.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>logFile.%d{yyyy-MM-dd}.log</fileNamePattern> </rollingPolicy> <encoder> <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern> </encoder> </appender> <root level="INFO"> <appender-ref ref="FILE" /> </root> </configuration>
maven jetty maven-jetty-plugin logback
Jihed amine
source share