diff --git a/solidify-model/src/main/resources/logback-spring.xml b/solidify-model/src/main/resources/logback-spring.xml index dfb9efa09e681aedfc49783745157eee65f76db1..cd39489a41413eb231263ef12e0bbe1e5e09eb30 100644 --- a/solidify-model/src/main/resources/logback-spring.xml +++ b/solidify-model/src/main/resources/logback-spring.xml @@ -1,17 +1,28 @@ <configuration> + + <!-- Output TEXT to console and to TEXT to file if configured with logging.* properties --> <springProfile name="basic-log"> <include resource="org/springframework/boot/logging/logback/base.xml"/> </springProfile> - <!-- When spring profile "prod" or "test" is used, logs are written in JSON format (this is set in order to ease logs consumption - when retrieving logs on K8s server with rancher-logging which parse logs using fluentd service)--> + <!-- Output JSON to console and TEXT to file if configured with logging.* properties --> <springProfile name="json-log"> - <include resource="org/springframework/boot/logging/logback/base.xml"/> + <!-- Output JSON to console --> <appender name="jsonConsoleAppender" class="ch.qos.logback.core.ConsoleAppender"> <encoder class="net.logstash.logback.encoder.LogstashEncoder"/> </appender> <root level="INFO"> <appender-ref ref="jsonConsoleAppender"/> </root> + + <!-- Output TEXT to file --> + <!-- Reuse the content of base.xml without the console appender --> + <!-- At major Spring upgrade check that this is still coherent --> + <include resource="org/springframework/boot/logging/logback/defaults.xml" /> + <property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/spring.log}"/> + <include resource="org/springframework/boot/logging/logback/file-appender.xml" /> + <root level="INFO"> + <appender-ref ref="FILE" /> + </root> </springProfile> </configuration> \ No newline at end of file