Skip to content

Commit

Permalink
- added logback-spring.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
MichiBaum committed Dec 22, 2023
1 parent ad4b5a9 commit a38310b
Show file tree
Hide file tree
Showing 23 changed files with 288 additions and 24 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
branches:
- master
- develop

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion admin-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.michibaum</groupId>
<artifactId>microservice</artifactId>
<version>1.0.0-TEST-6</version>
<version>1.0.0-TEST-7</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
6 changes: 6 additions & 0 deletions admin-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ spring:
eureka:
instance:
prefer-ip-address: true
client:
enabled: true
fetch-registry: true
register-with-eureka: true
refresh:
enable: true

management:
endpoints:
Expand Down
37 changes: 37 additions & 0 deletions admin-service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<property name="LOG_LOCATION" value="/var/log/application" />

<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}): %msg%n%throwable
</Pattern>
</layout>
</appender>

<appender name="RollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_LOCATION}/application.log</file>
<encoder
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
</encoder>

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily and when the file reaches 10 MegaBytes -->
<fileNamePattern>${LOG_LOCATION}/archived/application-%d{yyyy-MM-dd}.%i.log
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>

<!-- LOG everything at INFO level -->
<root level="info">
<appender-ref ref="RollingFile" />
<appender-ref ref="Console" />
</root>

</configuration>
2 changes: 1 addition & 1 deletion authentication-library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>microservice</artifactId>
<groupId>com.michibaum</groupId>
<version>1.0.0-TEST-6</version>
<version>1.0.0-TEST-7</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
6 changes: 3 additions & 3 deletions authentication-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>microservice</artifactId>
<groupId>com.michibaum</groupId>
<version>1.0.0-TEST-6</version>
<version>1.0.0-TEST-7</version>
</parent>

<artifactId>authentication-service</artifactId>
Expand Down Expand Up @@ -79,12 +79,12 @@
<dependency>
<groupId>com.michibaum</groupId>
<artifactId>authentication-library</artifactId>
<version>1.0.0-TEST-6</version>
<version>1.0.0-TEST-7</version>
</dependency>
<dependency>
<groupId>com.michibaum</groupId>
<artifactId>usermanagement-library</artifactId>
<version>1.0.0-TEST-6</version>
<version>1.0.0-TEST-7</version>
</dependency>

</dependencies>
Expand Down
6 changes: 6 additions & 0 deletions authentication-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ spring:
eureka:
instance:
prefer-ip-address: true
client:
enabled: true
fetch-registry: true
register-with-eureka: true
refresh:
enable: true

management:
endpoints:
Expand Down
37 changes: 37 additions & 0 deletions authentication-service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<property name="LOG_LOCATION" value="/var/log/application" />

<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}): %msg%n%throwable
</Pattern>
</layout>
</appender>

<appender name="RollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_LOCATION}/application.log</file>
<encoder
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
</encoder>

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily and when the file reaches 10 MegaBytes -->
<fileNamePattern>${LOG_LOCATION}/archived/application-%d{yyyy-MM-dd}.%i.log
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>

<!-- LOG everything at INFO level -->
<root level="info">
<appender-ref ref="RollingFile" />
<appender-ref ref="Console" />
</root>

</configuration>
28 changes: 20 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.7'
services:

registry-service:
image: 70131370/registry-service:1.0.0-TEST-6
image: 70131370/registry-service:1.0.0-TEST-7
env_file:
- .env
- .env.override
Expand All @@ -12,11 +12,13 @@ services:
spring_profiles_active: ${SPRING_ACTIVE_PROFILES}
expose:
- "8761"
volumes:
- /data/registry-service/logs:/var/log/application
networks:
- microservice-network

admin-service:
image: 70131370/admin-service:1.0.0-TEST-6
image: 70131370/admin-service:1.0.0-TEST-7
env_file:
- .env
- .env.override
Expand All @@ -27,11 +29,13 @@ services:
spring_profiles_active: ${SPRING_ACTIVE_PROFILES}
expose:
- "80"
volumes:
- /data/admin-service/logs:/var/log/application
networks:
- microservice-network

javadoc-service:
image: 70131370/javadoc-service:1.0.0-TEST-6
image: 70131370/javadoc-service:1.0.0-TEST-7
env_file:
- .env
- .env.override
Expand All @@ -42,11 +46,13 @@ services:
spring_profiles_active: ${SPRING_ACTIVE_PROFILES}
expose:
- "80"
volumes:
- /data/javadoc-service/logs:/var/log/application
networks:
- microservice-network

authentication-service:
image: 70131370/authentication-service:1.0.0-TEST-6
image: 70131370/authentication-service:1.0.0-TEST-7
env_file:
- .env
- .env.override
Expand All @@ -57,6 +63,8 @@ services:
spring_profiles_active: ${SPRING_ACTIVE_PROFILES}
expose:
- "80"
volumes:
- /data/authentication-service/logs:/var/log/application
networks:
- microservice-network

Expand All @@ -77,7 +85,7 @@ services:
- microservice-network

usermanagement-service:
image: 70131370/usermanagement-service:1.0.0-TEST-6
image: 70131370/usermanagement-service:1.0.0-TEST-7
env_file:
- .env
- .env.override
Expand All @@ -91,6 +99,8 @@ services:
DATABASE: ${USERMANAGEMENT_DB}
expose:
- "80"
volumes:
- /data/usermanagement-service/logs:/var/log/application
networks:
- microservice-network

Expand All @@ -111,7 +121,7 @@ services:
- microservice-network

gateway-service:
image: 70131370/gateway-service:1.0.0-TEST-6
image: 70131370/gateway-service:1.0.0-TEST-7
env_file:
- .env
- .env.override
Expand All @@ -122,10 +132,12 @@ services:
- authentication-service
- javadoc-service
- admin-service
ports:
- "80:80"
environment:
spring_profiles_active: ${SPRING_ACTIVE_PROFILES}
ports:
- "80:80"
volumes:
- /data/gateway-service/logs:/var/log/application
networks:
- microservice-network

Expand Down
4 changes: 2 additions & 2 deletions gateway-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>microservice</artifactId>
<groupId>com.michibaum</groupId>
<version>1.0.0-TEST-6</version>
<version>1.0.0-TEST-7</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>com.michibaum</groupId>
<artifactId>permission-library</artifactId>
<version>1.0.0-TEST-6</version>
<version>1.0.0-TEST-7</version>
</dependency>

</dependencies>
Expand Down
7 changes: 6 additions & 1 deletion gateway-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ spring:
username: admin
password: admin


eureka:
instance:
prefer-ip-address: true
client:
enabled: true
fetch-registry: true
register-with-eureka: true
refresh:
enable: true

management:
endpoints:
Expand Down
37 changes: 37 additions & 0 deletions gateway-service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<property name="LOG_LOCATION" value="/var/log/application" />

<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}): %msg%n%throwable
</Pattern>
</layout>
</appender>

<appender name="RollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_LOCATION}/application.log</file>
<encoder
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
</encoder>

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily and when the file reaches 10 MegaBytes -->
<fileNamePattern>${LOG_LOCATION}/archived/application-%d{yyyy-MM-dd}.%i.log
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>

<!-- LOG everything at INFO level -->
<root level="info">
<appender-ref ref="RollingFile" />
<appender-ref ref="Console" />
</root>

</configuration>
2 changes: 1 addition & 1 deletion javadoc-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>microservice</artifactId>
<groupId>com.michibaum</groupId>
<version>1.0.0-TEST-6</version>
<version>1.0.0-TEST-7</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
6 changes: 6 additions & 0 deletions javadoc-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ spring:
eureka:
instance:
prefer-ip-address: true
client:
enabled: true
fetch-registry: true
register-with-eureka: true
refresh:
enable: true

management:
endpoints:
Expand Down
37 changes: 37 additions & 0 deletions javadoc-service/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<property name="LOG_LOCATION" value="/var/log/application" />

<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}): %msg%n%throwable
</Pattern>
</layout>
</appender>

<appender name="RollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_LOCATION}/application.log</file>
<encoder
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%d %p %C{1.} [%t] %m%n</Pattern>
</encoder>

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily and when the file reaches 10 MegaBytes -->
<fileNamePattern>${LOG_LOCATION}/archived/application-%d{yyyy-MM-dd}.%i.log
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>

<!-- LOG everything at INFO level -->
<root level="info">
<appender-ref ref="RollingFile" />
<appender-ref ref="Console" />
</root>

</configuration>
Loading

0 comments on commit a38310b

Please sign in to comment.