From 3e3ee4ea496ad11002f55c6330d149e14cdc9cfb Mon Sep 17 00:00:00 2001 From: "A.P.Rajshekhar" Date: Sat, 9 Mar 2024 18:46:43 +0530 Subject: [PATCH] Closes #58: Use Spring Boot properties for log configuration --- gamedoora-user-services.service | 6 +++--- src/main/resources/application.properties | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gamedoora-user-services.service b/gamedoora-user-services.service index d91c57e..e95d59e 100644 --- a/gamedoora-user-services.service +++ b/gamedoora-user-services.service @@ -6,11 +6,11 @@ After=syslog.target gamedoora-config-server.service User=gamedoora ExecStart=/opt/gamedoora/gamedoora-user-services.jar SuccessExitStatus=143 -Environment="CONFIG_SERVER=http://localhost:8888" +Environment="CONFIG_SERVER=http://localhost:8888 LOG_PATH=/var/log/gamedoora/user_service_logs" # Redirect standard output and standard error to the main log file. -StandardOutput=file:/var/log/gamedoora/user_service_logs/user_services.log -StandardError=file:/var/log/gamedoora/user_service_logs/user_services.log +# StandardOutput=file:/var/log/gamedoora/user_service_logs/user_services.log +# StandardError=file:/var/log/gamedoora/user_service_logs/user_services.log # Rotate log based on days, capacity, file size, compress, etc. # LogsDirectory=/gamedoora/user_service_logs diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index db38dce..4b7ccc8 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -5,7 +5,7 @@ spring.config.import=optional:configserver:${CONFIG_SERVER} spring.jpa.open-in-view=false spring.flyway.baseline-on-migrate = true #logging.file.path= write logs to the current directory -logging.file.name=${LOG_PATH}/myapp.log +logging.file.name=${LOG_PATH}/userservice.log logging.pattern.file= %d{yyyy-MMM-dd HH:mm:ss.SSS} %-5level [%thread] %logger{15} - %msg%n logging.pattern.console= %d{yyyy-MMM-dd HH:mm:ss.SSS} %-5level [%thread] %logger{15} - %msg%n logging.level.com.gamedoora=DEBUG \ No newline at end of file