Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #17 from admin-ch/feature/sleuth-logging
Browse files Browse the repository at this point in the history
Added Sleuth logging
  • Loading branch information
martinalig authored Aug 6, 2021
2 parents 2a62628 + 1f6ffcc commit 22f13bc
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 40 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
**/*.log
**/*.log.*
**/.project
**/.classpath
**/.settings
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#

spring.profiles.active=security
spring.application.name=covidCertificate-app-transformation-service
management.endpoints.enabled-by-default=false
server.error.whitelabel.enabled=true

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>

<root level="INFO">
<appender-ref ref="console"/>
<appender-ref ref="flatfile"/>
</root>

</configuration>

This file was deleted.

12 changes: 12 additions & 0 deletions ch-covidcertificate-backend-transformation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<spring-boot-version>2.5.3</spring-boot-version>
<spring-cloud-sleuth-version>3.0.3</spring-cloud-sleuth-version>
<spring-cloud-connectors-version>2.2.13.RELEASE</spring-cloud-connectors-version>
<testcontainers-version>1.15.2</testcontainers-version>
<shedlock-version>4.24.0</shedlock-version>
Expand Down Expand Up @@ -78,6 +79,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
Expand Down Expand Up @@ -109,6 +114,13 @@
<version>${spring-boot-version}</version>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth</artifactId>
<version>${spring-cloud-sleuth-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down

0 comments on commit 22f13bc

Please sign in to comment.