> ## Documentation Index
> Fetch the complete documentation index at: https://docs.directgvr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Turn on debug logging by default

> Compile command-line arguments such as --debug into your launcher with builder.py.

Since DIRECT 6.1.0.66, you can compile command-line arguments into a launcher. Use this to turn on debug logging all the time, set a log folder, expire old logs or use any other argument in [Core command line](https://docs.directgvr.com/reference/client-skin-system/core-command-line.md).

## Requirements

* Deployment scripts version 3.3 or newer.

## Add arguments with builder.py

Use `--command_line` when you run [builder.py](https://docs.directgvr.com/release-automation/builder-script.md):

```bash theme={null}
builder.py --config=c:\temp\path_to\config\build_windows.json --command_line=debug
```

Repeat it for more arguments. This turns on debug logging and writes logs to `c:\temp\`:

```bash theme={null}
builder.py --config=c:\temp\path_to\config\build_windows.json --command_line=debug --command_line=debugdir="c:/temp/"
```

In a JSON configuration file, list the arguments in an array. This turns on debug logging, creates a log per day and deletes logs after 10 days:

```json build_windows.json theme={null}
{
  "target_os": "win64",
  "skin_directory": "../skins/launcher/",
  "launcher_path": "../builds/1.2.3/gamelauncher.exe",
  "cef_source_directory": "../cef/<cef-version>/win64/",
  "launcher_company": "Your Company Inc",
  "launcher_copyright": "2020",
  "launcher_product_name": "Game Launcher",
  "launcher_version": "1.2.3",
  "timestamp_service_url": "http://timestamp.digicert.com/#authenticode",
  "command_line": [
    "debug",
    "perday",
    "maxdays=10"
  ]
}
```

## Set a custom log folder

`debugdir` sets where the launcher writes logs. You can use [core expandable strings](https://docs.directgvr.com/reference/client-workflow-engine/core-expandable-strings.md) for user- or machine-specific folders:

```bash theme={null}
builder.py --config=c:\temp\path_to\config\build_windows.json --command_line=debug --command_line=debugdir="{CommonAppData}ProductName"
```

If an argument has spaces, wrap it in quotes and escape the quotes with backslashes:

```bash theme={null}
builder.py --config=c:\temp\path_to\config\build_windows.json --command_line=debug --command_line=debugdir="\"{UserAppData}My Product\""
```

The launcher then runs with `--debug --debugdir="{UserAppData}My Product"`.

> [!WARNING]
>
> Don't write logs next to the launcher. Players may install it in a protected folder such as `c:\Program Files\My Product\`. `--debugdir` is relative to the launcher's working folder, so `--debugdir=log` would try to write to `c:\Program Files\My Product\log\` and cause a fatal error. Use a macro or full path to a folder that doesn't need elevated privileges.

## Check the compiled arguments

Double-click the launcher, then open the log folder. By default, `host.developer.log` is written to:

* Windows: `C:\Users\USERNAME\AppData\LocalLow\CompanyName\ProductName` (DIRECT 6.1.2 and newer)
* macOS: `/Users/USERNAME/Library/Logs/ProductName/`
* Linux: `~/.local/share/CompanyName/ProductName/`

The log has a `Command Line` line that lists the arguments used:

```text theme={null}
10/18/2021 18:44:56 Command Line: "D:\SSN\deployscripts\3.3.12\builds\1.2.3\gamelauncher.exe" --debug --perday --maxdays=10
```

## Related

* [Run the client in debug mode](https://docs.directgvr.com/troubleshooting/debug-mode.md)
* [Compile launchers with the builder script](https://docs.directgvr.com/release-automation/builder-script.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.