Skip to content

Dev and prod logs are interleaved in the same debug log stream #134

@danshapiro

Description

@danshapiro

Problem

When development and production Freshell servers run on the same machine, both write to the same default debug log path (~/.freshell/logs/server-debug.jsonl). This interleaves events from different runtime modes (env: development and env: production) and different ports in one stream.

Why this is bad

  • Triage is error-prone: timeline analysis mixes unrelated processes
  • Backpressure/perf investigations can draw incorrect conclusions
  • Automated log parsing cannot reliably attribute events to an instance

Evidence

In a single file we observed:

  • dev listener (port: 3002) and prod listener (port: 3001) startup events
  • alternating perf samples and WS events tagged with different env values

Expected

Each server instance should write to an isolated log stream by default (or include instance-specific file naming), so dev/prod and multi-instance runs are attributable without manual filtering.

Suggested fix

  • Include mode and instance dimensions in log filename by default, e.g. server-debug.<env>.<port-or-instanceId>.jsonl
  • Optionally include PID in filename
  • Keep LOG_DEBUG_PATH override behavior unchanged
  • Add a startup log line explicitly printing resolved log file path for that instance

Acceptance criteria

  • Running dev and prod simultaneously produces separate debug files
  • No interleaving between instances in default configuration
  • Docs mention the per-instance log behavior and override controls

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions