Skip to content

sessions.log grows without bound; APPDATA fallback writes relative to CWD #54

Closed

Description

@TMHSDigital

Summary

%APPDATA%\WindowsAutoclicker\sessions.log is append-only and never rotated or trimmed, while autoclicker.log already uses a RotatingFileHandler capped at 3 MB. If APPDATA is unset, both the session log and the settings path fall back to a path relative to the CWD.

Evidence

  • autoclicker/core/session_log.py:17-35 — path.open("a"), no size check. Also swallows every OSError silently.
  • autoclicker/core/logging_setup.py:33-38 — the rotating handler shows the existing pattern.
  • session_log.py:19, core/settings_paths.py:19 — Path(os.environ.get("APPDATA", "")).

Suggested approach

  • Route session events through a dedicated logging logger with its own RotatingFileHandler (e.g. 1 MB × 3), keeping the TSV format.
  • Centralise the app-data directory in one helper that falls back to Path.home() / "AppData/Roaming" (or platformdirs) instead of "".
  • Log a debug message instead of silently passing on OSError.

Done when

sessions.log is size-bounded (test), and no app data is written relative to the CWD when APPDATA is missing.

Activity

  1. added
    bug
    priority: low
    maintenance
    on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmaintenancepriority: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions