Skip to content

Commit

Permalink
MOVE-3841 Implement structured logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Hmengland committed Jun 20, 2024
1 parent 135fc7a commit 3781207
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 16 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>4.9</version>
<version>7.3</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
Expand Down
32 changes: 17 additions & 15 deletions serviceregistry-server/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
spring:
application:
environment: dev
datasource:
url: ${DATASOURCE_URL}
username: ${DATASOURCE_USERNAME}
password: ${DATASOURCE_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
security:
user:
name: ${ADMIN_API_USERNAME}
password: ${ADMIN_API_PASSWORD}

server:
port: 8080
servlet:
Expand All @@ -22,21 +39,6 @@ management:
readinessState:
enabled: true

spring:
datasource:
url: ${DATASOURCE_URL}
username: ${DATASOURCE_USERNAME}
password: ${DATASOURCE_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
security:
user:
name: ${ADMIN_API_USERNAME}
password: ${ADMIN_API_PASSWORD}

difi:
move:
fiks:
Expand Down
23 changes: 23 additions & 0 deletions serviceregistry-server/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>

<configuration>
<springProperty name="APP-NAME" source="spring.application.name" defaultValue="-"/>
<springProperty name="APP-ENV" source="spring.application.environment" defaultValue="-"/>

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

<appender name="APPLICATION" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<includeMdc>true</includeMdc>
<customFields>{"application":"${APP-NAME}","environment":"${APP-ENV}","logtype":"application"}</customFields>
</encoder>
</appender>

<logger name="no.difi" level="INFO" additivity="false">
<appender-ref ref="APPLICATION"/>
</logger>

<root level="WARN">
<appender-ref ref="APPLICATION"/>
</root>
</configuration>

0 comments on commit 3781207

Please sign in to comment.