Skip to navigation

TWS and IB Gateway can be configured to create a separate log file which has a record of just communications with API applications. This log is not enabled by default; but needs to be enabled by the Global Configuration setting.

Information

  • API logs contain a record of exchanged messages between API applications and TWS/IB Gateway. Since only API messages are recorded, the API logs are more compact and easier to handle. However they do not contain general diagnostic information about TWS/IBG as the TWS/IBG logs. The TWS/IBG settings folder is by default C:\Jts (or IBJts on Mac/Linux). The API logs are named api.[clientId].[day].log, where [clientId] corresponds to the Id the client application used to connect to the TWS and [day] to the week day (i.e. api.123.Thu.log).
  • The setting “Include Market Data in API Log” that will include streaming market data values in the API log file. Historical candlestick data is always recorded in the API log.
  • These files are stored on the clients machine and are only sent to Interactive Brokers by client request.
  • These logs will recycle every 7 days. This would include the current day and the prior 6 days.
Both the API and TWS logs are encrypted locally. Unless decrypted through Trader Workstation or IB Gateway, the logs are illegible.

Enable creation of API logs

TWS:

  1. Navigate to File/Edit → Global Configuration → API → Settings
  2. Check the box Create API message log file
  3. Set Logging Level to Detail
  4. Click Apply and Ok

TWS Global Configuration window displaying API settings with API logging.

IB Gateway:

  1. Navigate to Configure → Settings → API → Settings
  2. Check the box Create API message log file
  3. Set Logging Level to Detail
  4. Click Apply and Ok

IB Gateway settings window displaying API settings with API logging.