Skip to content

Add support for automatic API log file configuration #346

@mosheDO

Description

@mosheDO

Feature Request

Problem

When running IB Gateway/TWS in automated environments (Docker, cloud VMs, CI/CD), users need to enable API logging for debugging. Currently this requires:

  1. Manual GUI configuration (not suitable for ephemeral VMs)
  2. Patching tws.xml files (fragile, breaks on IBKR updates)

How IBC Already Solves Similar Problems

IBC has existing mechanisms to automatically configure TWS/Gateway settings by interacting with the GUI:

  • AUTO_LOGOFF_TIME - configures automatic logoff time
  • READ_ONLY_API - enables/disables read-only API mode
  • AcceptNonBrokerageAccountWarning=yes - accepts paper trading warning
  • Dialog handling for login, connection approvals, etc.

Proposed Solution

Add similar automatic configuration for API logging settings by interacting with the Global Configuration → API → Settings dialog.

Suggested Environment Variables

CREATE_API_MESSAGE_LOG_FILE=true
API_LOGGING_LEVEL=Detail  # Options: Error, Warning, System, Notice, Incoming, Outgoing, Detail
INCLUDE_MARKET_DATA_IN_API_LOG=false

How It Would Work

IBC would:

  1. Navigate to Configure → Settings → API → Settings (or File → Global Configuration → API → Settings)
  2. Check/uncheck "Create API message log file" based on CREATE_API_MESSAGE_LOG_FILE
  3. Set "Logging Level" dropdown based on API_LOGGING_LEVEL
  4. Optionally check "Include market data in API log file" based on INCLUDE_MARKET_DATA_IN_API_LOG
  5. Click Apply/OK

Benefits

  • Consistent with existing IBC architecture
  • Works regardless of tws.xml structure changes
  • Leverages existing window automation infrastructure
  • No XML patching required

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions