Commit 072d51bd authored by Daniel Gerhardt's avatar Daniel Gerhardt

Setup logging with Logback

parent f4d46c11
......@@ -29,6 +29,7 @@ dependencies {
implementation group: 'org.springframework.security', name: 'spring-security-ldap'
implementation group: 'cglib', name: 'cglib', version: '3.1'
implementation group: 'ch.qos.logback', name: 'logback-classic'
implementation group: 'org.codehaus.janino', name: 'janino'
implementation group: 'org.json', name: 'json', version: '20141113'
providedCompile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.0.1'
......@@ -45,6 +46,8 @@ test { systemProperties 'property': 'value' }
gretty {
servletContainer = 'jetty9.4'
logbackConfigFile = 'src/main/resources/logback.xml'
jvmArgs = ['-Darsnova.log.level=DEBUG']
}
sonarqube {
......
<configuration>
<if condition='isDefined("arsnova.log.properties")'>
<then>
<property file="${arsnova.log.properties}" />
</then>
</if>
<if condition='!isDefined("arsnova.log.level")'>
<then>
<property name="arsnova.log.level" value="${arsnova.log.level.root:-INFO}" />
</then>
</if>
<if condition='!isDefined("arsnova.log.level.spring")'>
<then>
<property name="arsnova.log.level.spring" value="${arsnova.log.level.root:-INFO}" />
</then>
</if>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} %highlight(%-5level) %logger{36} - %msg%n%ex{${arsnova.log.exceptions:-short}}</pattern>
</encoder>
<if condition='isDefined("arsnova.log.file")'>
<then>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
</filter>
</then>
</if>
</appender>
<if condition='isDefined("arsnova.log.file")'>
<then>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss} %highlight(%-5level) %logger{36} - %msg%n%ex{${arsnova.log.exceptions:-short}}</pattern>
</encoder>
<file>${arsnova.log.file}</file>
</appender>
</then>
</if>
<root level="${arsnova.log.level.root:-INFO}">
<appender-ref ref="STDOUT" />
<if condition='isDefined("arsnova.log.file")'>
<then>
<appender-ref ref="FILE" />
</then>
</if>
</root>
<logger name="de.thm.arsnova" level="${arsnova.log.level}" />
<logger name="org.springframework" level="${arsnova.log.level.spring}" />
</configuration>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment