From 9e943f0a673f1ffd45f868ccb0eb6de2133b40d5 Mon Sep 17 00:00:00 2001 From: Matus Kasak Date: Tue, 11 Aug 2026 16:14:40 +0200 Subject: [PATCH] fix(logging): write dspace.log inside the container again Port of #1392 (MENDELU/fix-dspace-log-to-file, merged to customer/mendelu) to dtq-dev-9-base. Everything the backend logs comes out as container stdout only, and [dspace.dir]/log/dspace.log is never created. log4j2-container.xml is console-only by design upstream -- its header says "matches log4j2.xml but to console, removing file refs" and both appenders are type='Console'. log4j2-cli.xml is untouched and already writes dspace-cli.log/checker.log, which is why /dspace/log exists in the container but holds no dspace.log. A1 becomes the same RollingFile appender log4j2.xml uses on this branch, and a separate STDOUT appender echoes the same events to the console so "docker logs" keeps working unchanged. Adapted from #1392 for this branch: filePattern has no ".gz" suffix, to match dspace/config/log4j2.xml here, which rolls over to plain dspace.log-yyyy-MM-dd. The commented-out sample deletion policy glob was adjusted to match. Two optional knobs, both defaulting to current behaviour: - DSPACE_LOG_DIR log directory, default /dspace/log - DSPACE_LOG_CONSOLE_LEVEL level of the stdout copy, default INFO Log levels, the checksum-checker appender and the blocked org.dspace.* loggers are left alone. Co-Authored-By: Claude Opus 5 (1M context) --- dspace/config/log4j2-container.xml | 55 ++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/dspace/config/log4j2-container.xml b/dspace/config/log4j2-container.xml index 9fd358c72a1f..83a7f4002b27 100644 --- a/dspace/config/log4j2-container.xml +++ b/dspace/config/log4j2-container.xml @@ -1,21 +1,70 @@ - + + + ${env:DSPACE_LOG_DIR:-/dspace/log} + + INFO + + INFO + + + ${env:DSPACE_LOG_CONSOLE_LEVEL:-INFO} + + + + yyyy-MM-dd + + + + + + + + + @@ -33,6 +82,7 @@ level='${loglevel.dspace}' additivity='false'> + @@ -60,6 +110,7 @@ +