Commit 006bed9a authored by serviceAcc.5d68fd845b842's avatar serviceAcc.5d68fd845b842

Merge branch 'add_logs_to_rolling_files' into 'develop'

Add logging to files - to change, add an environment variable called...

See merge request !48
parents 697190b2 0a6c4106
Pipeline #169119 passed with stage
in 5 minutes and 2 seconds
......@@ -28,6 +28,7 @@ services:
token_secret: ${token_secret}
recaptcha_site_key: ${recaptcha_site_key}
recaptcha_secret_key: ${recaptcha_secret_key}
marketplace_log_dir: /log
labels:
- traefik.backend=marketplace-api
- traefik.frontend.rule=Host:marketplace-api.sisyphos.arz.oeaw.ac.at,sshoc-marketplace-api.acdh-dev.oeaw.ac.at
......
version: "2"
services:
marketplace-prod:
build: .
build:
context: .
dockerfile: Dockerfile-acdh-ch
args:
- GID=1031
- UID=1031
image: docker.gitlab.gwdg.de/sshoc/sshoc-marketplace-backend/api-prod:latest
container_name: sshoc-marketplace-backend-api-prod
ports:
......@@ -23,6 +28,7 @@ services:
token_secret: ${token_secret}
recaptcha_site_key: ${recaptcha_site_key}
recaptcha_secret_key: ${recaptcha_secret_key}
marketplace_log_dir: /log
labels:
- traefik.backend=marketplace-api-prod
- traefik.frontend.rule=Host:marketplace-api-prod.sisyphos.arz.oeaw.ac.at,sshoc-marketplace-api.acdh.oeaw.ac.at,marketplace-api.sshoc.eu,marketplace-api.sshopencloud.eu
......@@ -32,6 +38,9 @@ services:
networks:
- backend
- web
volumes:
- app-log:/log
psql-prod:
image: postgres:9.6
container_name: sshoc-marketplace-backend-postgres-prod
......@@ -84,3 +93,9 @@ volumes:
type: "none"
device: "/home/sshocmarketplacecuration/shares/solr-data"
o: "bind"
app-log:
driver: local
driver_opts:
type: "none"
device: "/home/sshocmp/shares/app-log"
o: "bind"
......@@ -16,6 +16,7 @@ services:
token_secret: ${token_secret}
recaptcha_site_key: ${recaptcha_site_key}
recaptcha_secret_key: ${recaptcha_secret_key}
marketplace_log_dir: /tmp
psql:
image: postgres:9.6
......
package eu.sshopencloud.marketplace;
import eu.sshopencloud.marketplace.conf.auth.SecurityProperties;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
......@@ -19,7 +18,6 @@ import io.swagger.v3.oas.models.security.SecurityScheme;
@SpringBootApplication
@EnableCaching
@EnableConfigurationProperties(SecurityProperties.class)
@Slf4j
public class MarketplaceApplication {
......@@ -33,7 +31,6 @@ public class MarketplaceApplication {
}
public static void main(String[] args) {
log.debug("APPLICATION_PROFILE variable: " + System.getenv("APPLICATION_PROFILE"));
String egiId = System.getenv("egi_id");
if (StringUtils.isNotBlank(egiId)) {
System.setProperty("egi_client_id", egiId);
......
spring:
datasource:
url: "jdbc:postgresql://localhost:5433/marketplace_db"
jpa:
show-sql: true
data:
solr:
host: "http://localhost:8984/solr"
datasource:
url: "jdbc:postgresql://localhost:5433/marketplace_db"
jpa:
show-sql: true
data:
solr:
host: "http://localhost:8984/solr"
liquibase:
contexts: test
liquibase:
contexts: test
......@@ -89,3 +89,6 @@ marketplace:
jwt-token-expiration-msec: 86400000
oauth:
implicit-grant-token-expiration-msec: 30000
logging:
path: ${marketplace_log_dir:/tmp}
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="pattern" value="%d{dd-MM-yyyy HH:mm:ss.SSS} %magenta([%thread]) %highlight(%-5level) %logger{36}.%M - %msg%n" />
<springProperty scope="context" name="LOG_DIRECTORY" source="marketplace.logging.path" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{dd-MM-yyyy HH:mm:ss.SSS} %magenta([%thread]) %highlight(%-5level) %logger{36}.%M - %msg%n</pattern>
<pattern>${pattern}</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_DIRECTORY}/sshoc-marketplace-backend-app.log</file>
<append>true</append>
<encoder>
<pattern>${pattern}</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOG_DIRECTORY}/%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>100MB</maxFileSize>
<maxHistory>90</maxHistory>
<totalSizeCap>10GB</totalSizeCap>
</rollingPolicy>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
<logger name="eu.sshopencloud.marketplace" level="DEBUG" />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment