Skip to content

OpenRGB logs to `$XDG_CONFIG_HOME/OpenRGB/logs` on Linux by default (and it seems like the log path override is broken)

I try to keep my home and config directories pretty clean: https://xdgbasedirectoryspecification.com/

It would be awesome if the XDG_BASE_DIR spec was respected by default (and cache / log files went to $XDG_CACHE_HOME by default). I discovered that OpenRGB was not doing this when I found ~4GB of OpenRBG logs that I was backing up in my "config backup".

Logging is set up here: https://gitlab.com/CalcProgrammer1/OpenRGB/-/blob/master/LogManager.cpp#L58-124

It looks like adding the key logfile to the config should let me override it, but it doesn't seem to work for me. Here's a copy of my config:

{
  "AutoStart": {
    "client": "localhost:6742",
    "custom": "",
    "enabled": false,
    "host": "0.0.0.0",
    "port": "6742",
    "profile": "",
    "setclient": false,
    "setcustom": false,
    "setminimized": false,
    "setprofile": false,
    "setserver": false,
    "setserverhost": false,
    "setserverport": false
  },
  "CorsairDominatorSettings": {
    "model": "CMT"
  },
  "Detectors": {
    "detectors": {
      ...
    ]
  },
  "Gigabyte RGB Fusion 2 USB": {
    "Calibration": {
      "Data": {
        "D_LED1": "GRB",
        "D_LED2": "GRB",
        "Mainboard": "BGR",
        "Spare": "BGR"
      },
      "Enabled": false
    },
    "CustomLayout": {
      "Data": {
        "D_LED1 Bottom": [
          {
            "header": "LED6",
            "name": "Name for LED Strip 1"
          }
        ],
        "D_LED2 Top": [
          {
            "header": "LED7",
            "name": "Name for LED Strip 2"
          }
        ],
        "Motherboard": [
          {
            "header": "LED1",
            "name": "Name for Led 1"
          },
          {
            "header": "LED2",
            "name": "Name for Led 2"
          },
          {
            "header": "LED3",
            "name": "Name for Led 3"
          },
          {
            "header": "LED4",
            "name": "Name for Led 4"
          },
          {
            "header": "LED5",
            "name": "Name for Led 5"
          },
          {
            "header": "LED8",
            "name": "Name for Led 8"
          }
        ]
      },
      "Enabled": false
    },
    "MotherboardLayouts": {
      "B550 AORUS ELITE": "STD_ATX",
      "B550 AORUS PRO": "STD_ATX",
      "B550I AORUS PRO AX": "ITX",
      "X570 AORUS ELITE": "STD_ATX",
      "X570 AORUS ELITE WIFI": "STD_ATX",
      "X570 AORUS MASTER": "MSTR_ATX_3",
      "X570 AORUS PRO WIFI": "STD_ATX",
      "X570 AORUS ULTRA": "STD_ATX",
      "X570 I AORUS PRO WIFI": "ITX",
      "X670E AORUS MASTER": "MSTR_ATX_2",
      "Z390 AORUS MASTER-CF": "MSTR_ATX"
    }
  },
  "Theme": {
    "theme": "dark"
  },
  "UserInterface": {
    "RunZoneChecks": true,
    "exit_profile": {
      "profile_name": "",
      "set_on_exit": false
    },
    "geometry": {
      "height": 0,
      "load_geometry": false,
      "save_on_exit": false,
      "width": 0,
      "x": 0,
      "y": 0
    },
    "greyscale_tray_icon": false,
    "language": "default",
    "minimize_on_close": false
  },
  "logfile": "/tmp/openrgb"
}

See the last line for what I added.

This code also does not seem to expand env vars, so I couldn't set the logpath to $XDG_CACHE_HOME/openrgb or something.

Is this something you'd consider fixing?

Edited by Aaron Lichtman