Skip to content

Commit

Permalink
Version up & Logrelay
Browse files Browse the repository at this point in the history
  • Loading branch information
martinalig committed Sep 3, 2021
1 parent 012ebcb commit b92cad0
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 49 deletions.
10 changes: 8 additions & 2 deletions dpppt-additionalinfo-backend/pom.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
<groupId>org.dpppt</groupId>
<artifactId>dpppt-additionalinfo-backend</artifactId>
<packaging>jar</packaging>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
<name>DP3T Additional Info Backend</name>

<properties>
<java-version>11</java-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring-boot-version>2.3.9.RELEASE</spring-boot-version>
<spring-boot-version>2.5.4</spring-boot-version>
<itCoverageAgent></itCoverageAgent>
<build-helper-maven-plugin.version>1.9.1</build-helper-maven-plugin.version>
</properties>
Expand Down Expand Up @@ -99,6 +99,12 @@
<artifactId>logback-classic</artifactId>
</dependency>

<dependency>
<groupId>ch.admin.bag.covidcertificate</groupId>
<artifactId>cc-backend-logging</artifactId>
<version>1.0.0</version>
</dependency>

<!-- Spring Security Core -->
<dependency>
<groupId>org.springframework.security</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

@Configuration
@ComponentScan(basePackages = {"org.dpppt.additionalinfo.backend.ws.config"})
@ComponentScan(basePackages = {"org.dpppt.additionalinfo.backend.ws.config",
"ch.admin.bag.covidcertificate.log",
"ch.admin.bag.covidcertificate.rest"})
@EnableAutoConfiguration
@EnableWebMvc
public class Application {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
logging.config=classpath:local-logback.xml
3 changes: 2 additions & 1 deletion dpppt-additionalinfo-backend/src/main/resources/application.properties
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#
# SPDX-License-Identifier: MPL-2.0
#
spring.profiles.active=dev
spring.application.name=swisscovid-additionalinfo-service
spring.profiles.active=dev,local
server.port=8080
management.endpoints.enabled-by-default=false
ws.ecdsa.credentials.privateKey=LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JR0VBZ0VBTUJBR0J5cUdTTTQ5QWdFR0JTdUJCQUFLQkcwd2F3SUJBUVFnMkRsai9lNW5rRlBtTk1MVjd1NjQKenFuOHdSeVgrUTgyc045RDRSWXlvNjJoUkFOQ0FBVGFzRmgwR0tlazVZNEp1d2dpNUg4QWsvcWZqa0pDd3o3UApYb0lVZWJnaXN5N1RWUUxySW1CUFU3aWcwMzdrMGRvVXhrK1hkQktYNDN2L3JkR1lVS2YxCi0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K
Expand Down
58 changes: 58 additions & 0 deletions dpppt-additionalinfo-backend/src/main/resources/local-logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
~ Copyright (c) 2020 Ubique Innovation AG <https://www.ubique.ch>
~
~ This Source Code Form is subject to the terms of the Mozilla Public
~ License, v. 2.0. If a copy of the MPL was not distributed with this
~ file, You can obtain one at https://mozilla.org/MPL/2.0/.
~
~ SPDX-License-Identifier: MPL-2.0
-->

<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>

<property resource="application.properties"/>
<springProperty scope="context" name="springAppName" source="spring.application.name"/>
<property name="LOG_FILE" value="${springAppName}"/>

<!-- You can override this to have a custom pattern -->
<!-- Make sure not to remove LOG_LEVEL_PATTERN, as it's needed by Sleuth -->
<property name="CONSOLE_LOG_PATTERN"
value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>


<!-- Appender to log to console -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<!-- Minimum logging level to be presented in the console logs-->
<level>DEBUG</level>
</filter>
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
</appender>

<!-- Appender to log to file -->
<appender name="flatfile" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_FILE}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.gz</fileNamePattern>
<maxHistory>7</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>512KB</MaxFileSize>
</triggeringPolicy>
</appender>
<logger name="org.dpppt" level="DEBUG"/>
<root level="INFO">
<appender-ref ref="console"/>
<appender-ref ref="flatfile"/>
</root>

</configuration>
40 changes: 0 additions & 40 deletions dpppt-additionalinfo-backend/src/main/resources/logback.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics;

@ActiveProfiles({"actuator-security"})
@SpringBootTest(
Expand All @@ -37,6 +38,8 @@
"management.endpoints.enabled-by-default=true",
"management.endpoints.web.exposure.include=*"
})
// to make sure prometheus is exposed in tests
@AutoConfigureMetrics
public class DppptAdditionalInfoControllerTest extends BaseControllerTest {

@Autowired private Filter springSecurityFilterChain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
import org.springframework.context.annotation.ComponentScan;
import org.springframework.test.context.ActiveProfiles;

@ComponentScan(basePackages = {"org.dpppt.additionalinfo.backend.ws.config"})
@ComponentScan(basePackages = {"org.dpppt.additionalinfo.backend.ws.config",
"ch.admin.bag.covidcertificate.log",
"ch.admin.bag.covidcertificate.rest"})
@SpringBootApplication
@ActiveProfiles("postgres")
public class TestApplication {}
public class TestApplication {

}

0 comments on commit b92cad0

Please sign in to comment.