feat(startup): stream error.log to console by default; add LOG_STREAM selector
This commit is contained in:
10
CHANGELOG.md
10
CHANGELOG.md
@@ -2,11 +2,13 @@
|
|||||||
|
|
||||||
## Changes 10/7/2025 (no new version)
|
## Changes 10/7/2025 (no new version)
|
||||||
|
|
||||||
feat(start.sh): stream Apache logs to console + startup polish
|
feat(startup): stream error.log to console by default; add LOG_STREAM selector
|
||||||
|
|
||||||
- Tail /var/www/metadata/log/{access,error}.log to container stdout (STREAM_LOGS=true by default)
|
- Touch error/access logs on start so tail can attach immediately
|
||||||
- Ensure log/session dirs exist with sane perms; no port/vhost changes
|
- Add LOG_STREAM=error|access|both|none (default: error)
|
||||||
- Keep Apache in foreground; clearer startup message
|
- Tail with `-n0 -F` to follow new entries only and survive rotations
|
||||||
|
- Keep access.log on disk but don’t spam console unless requested
|
||||||
|
- (Unraid) Optional env var template entry for LOG_STREAM
|
||||||
|
|
||||||
## Changes 10/6/2025 v1.3.15
|
## Changes 10/6/2025 v1.3.15
|
||||||
|
|
||||||
|
|||||||
26
start.sh
26
start.sh
@@ -56,11 +56,9 @@ fi
|
|||||||
mkdir -p /var/www/metadata/log
|
mkdir -p /var/www/metadata/log
|
||||||
chown www-data:www-data /var/www/metadata/log
|
chown www-data:www-data /var/www/metadata/log
|
||||||
chmod 775 /var/www/metadata/log
|
chmod 775 /var/www/metadata/log
|
||||||
|
|
||||||
: > /var/www/metadata/log/access.log
|
|
||||||
: > /var/www/metadata/log/error.log
|
: > /var/www/metadata/log/error.log
|
||||||
chown www-data:www-data /var/www/metadata/log/access.log /var/www/metadata/log/error.log
|
: > /var/www/metadata/log/access.log
|
||||||
chmod 664 /var/www/metadata/log/access.log /var/www/metadata/log/error.log
|
chown www-data:www-data /var/www/metadata/log/*.log
|
||||||
|
|
||||||
mkdir -p /var/www/sessions
|
mkdir -p /var/www/sessions
|
||||||
chown www-data:www-data /var/www/sessions
|
chown www-data:www-data /var/www/sessions
|
||||||
@@ -159,12 +157,16 @@ if [ "${SCAN_ON_START:-}" = "true" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# 9.6) Stream Apache logs to the container console (optional toggle)
|
# 9.6) Stream Apache logs to the container console (optional toggle)
|
||||||
if [ "${STREAM_LOGS:-true}" = "true" ]; then
|
LOG_STREAM="${LOG_STREAM:-error}"
|
||||||
echo "[startup] Streaming Apache logs to container console..."
|
case "${LOG_STREAM,,}" in
|
||||||
# access.log -> STDOUT, error.log -> STDERR
|
none) STREAM_ERR=false; STREAM_ACC=false ;;
|
||||||
tail -n0 -F /var/www/metadata/log/access.log >> /proc/1/fd/1 &
|
access) STREAM_ERR=false; STREAM_ACC=true ;;
|
||||||
tail -n0 -F /var/www/metadata/log/error.log >> /proc/1/fd/2 &
|
both) STREAM_ERR=true; STREAM_ACC=true ;;
|
||||||
fi
|
error|*)STREAM_ERR=true; STREAM_ACC=false ;;
|
||||||
|
esac
|
||||||
|
|
||||||
echo "✅ Apache starting (foreground). Check container logs for access/error output…"
|
echo "🔥 Starting Apache..."
|
||||||
exec apachectl -D FOREGROUND
|
# Stream only the chosen logs; -n0 = don't dump history, -F = follow across rotations/creation
|
||||||
|
[ "${STREAM_ERR}" = "true" ] && tail -n0 -F /var/www/metadata/log/error.log 2>/dev/null &
|
||||||
|
[ "${STREAM_ACC}" = "true" ] && tail -n0 -F /var/www/metadata/log/access.log 2>/dev/null &
|
||||||
|
exec apachectl -D FOREGROUND
|
||||||
Reference in New Issue
Block a user