Skip to content

observability: Add session-aware log directory routing#152

Open
stefanskoricdev wants to merge 6 commits into
mainfrom
log-to-dir
Open

observability: Add session-aware log directory routing#152
stefanskoricdev wants to merge 6 commits into
mainfrom
log-to-dir

Conversation

@stefanskoricdev

@stefanskoricdev stefanskoricdev commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
  • Updated logging to write to append-only, date and session-specific log files within the configured log directory instead of a single log file.
  • Extended the logger trait to accept optional session IDs, enabling per-session log file partitioning.
  • Propagated producer-native session IDs through the diff-trace and conversation-trace logging pipelines.
  • Improved logging resilience. If opening or writing to a log file fails, the logger automatically retries using a v2 version of the same log file before propagating the error.
  • Added automatic log retention. Whenever a new log file is created, older log files are removed according to the configured retention limit. The retention limit can be configured through the SCE configuration and defaults to retaining the 10 most recent log files.
  • Added observability log_dir resolution with the following precedence:
    1. SCE_LOG_DIR environment variable
    2. Configuration file
    3. Default location: <state_root>/sce/logs

@stefanskoricdev
stefanskoricdev marked this pull request as ready for review July 22, 2026 13:33
@stefanskoricdev
stefanskoricdev requested review from davidabram and ivke995 and removed request for davidabram July 22, 2026 15:49
stefanskoricdev and others added 6 commits July 23, 2026 18:10
Replace log_file/log_file_mode with log_dir/SCE_LOG_DIR across config schema, resolution, and config rendering.

Route enabled log records to append-only date/session-specific files under the configured directory while preserving stderr emission and fail-open file write diagnostics. Thread optional session IDs through logger trait methods for per-session file partitioning.

Co-authored-by: SCE <sce@crocoder.dev>
Propagate producer-native session IDs through diff-trace and conversation-trace logging. Emit dedicated database-open errors without duplicate generic diagnostics while preserving fail-open behavior.

Co-authored-by: SCE <sce@crocoder.dev>
Keep configured log directories bounded by retaining the 10 newest direct regular .log files after a new log file is created. Existing-file appends skip cleanup, and cleanup failures fail open with redacted stderr diagnostics.

Co-authored-by: SCE <sce@crocoder.dev>
Resolve observability log_dir through SCE_LOG_DIR, config file, then the
canonical <state_root>/sce/logs default. Centralize the default path in the
shared default path catalog so config resolution and path ownership stay aligned.

Co-authored-by: SCE <sce@crocoder.dev>
Retry the complete rendered record at a sibling -v2.log path when primary open, append, or flush fails. Keep fallback non-recursive and apply retention after newly created fallback files.

Co-authored-by: SCE <sce@crocoder.dev>
Add a positive log_file_retention_limit config value with a default of 10 and expose its resolved provenance through config show.

Apply the resolved limit to retention cleanup for primary and v2 log files.

Co-authored-by: SCE <sce@crocoder.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants