I try to build a standalone version (executable jar) of a webapp. So I use jetty to load the war file.
The war file already contains slf4j and logback as dependencies.
In my standalone app I have a logback.xml
to define the logger definitions.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="app" class="ch.qos.logback.core.FileAppender">
<file>/tmp/app.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="${log.level}">
<appender-ref ref="app"/>
</root>
</configuration>
This works fine, but it does still output the logging information for jetty on the console instead of the logging file (all of the app logging goes into my log file). In the jetty documentation I found that I need to include the logging framework also in my embedding app. So I included slf4j and logback, but now I get the SLF4J: Class path contains multiple SLF4J bindings. error and it does not log into my files.
How can I fix this?
Versions:
- jetty: 9.0.1.v20130408
- logback: 1.0.7
- slf4j: 1.7.2