The logger was initialised to console format unconditionally, so the "Config file loaded" message (and similar early logs) were always written as human-readable text even when JSON logging was configured. Root cause: classic chicken-and-egg — the format flag lives inside the config that is being loaded. Fix: add peekJSONLogging() which resolves the format before any log is emitted by (1) checking DLC_LOGGING_JSON directly via os.Getenv, then (2) doing a minimal throwaway Viper pre-read of the config file for the logging.json key. The redundant format-switch block that ran after Unmarshal() is removed. Also add the "Logging configured" log as the very first line, and replace the hardcoded PROJECT_DIR path in start-server.sh, test-graceful-shutdown.sh, and test-opentelemetry.sh with a dynamic derivation from BASH_SOURCE[0]. Closes #15 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
17 KiB
17 KiB