Skip to content

Instantly share code, notes, and snippets.

@prappo
Last active June 3, 2026 17:17
Show Gist options
  • Select an option

  • Save prappo/894fb83f6ffcce95138167c4fdaa3113 to your computer and use it in GitHub Desktop.

Select an option

Save prappo/894fb83f6ffcce95138167c4fdaa3113 to your computer and use it in GitHub Desktop.
Enable WordPress debugging and map debug.log file for wp-env
{
"plugins": ["."],
"config": {
"WP_DEBUG": true,
"WP_DEBUG_LOG": true,
"SCRIPT_DEBUG": true,
"WP_DEBUG_DISPLAY": true,
"WP_PHP_BINARY": "php"
},
"mappings": {
"wp-content/debug.log": "./debug.log"
}
}
@greenworld

Copy link
Copy Markdown

Thank you for a useful config snippet

Mapping is not working properly for me (directory ./debug.log is created instead of file) to fix need to remove folder and create locally file ./debug.log with appropriate permissions

@lbonomo

lbonomo commented Dec 29, 2024

Copy link
Copy Markdown

I had the same issue

@lbonomo

lbonomo commented Jan 13, 2025

Copy link
Copy Markdown

Hi @greenworld, I use another way to fix it

    "config": {
        "WP_DEBUG": true,
        "WP_DEBUG_DISPLAY": true,
        "SCRIPT_DEBUG": false,
        "WP_DEBUG_LOG": "/var/www/html/wp-content/plugins/[plugin-slug]/debug.log"
    }

@dannyvankooten

Copy link
Copy Markdown

@greenworld @lbonomo Are you guys on Linux by any chance? I believe it has to do with mappings expecting a directory mapping, yet debug.log is a file.

Another fix is to move it inside a directory and map that instead.

{
    "mappings": {
        "./wp-content/logs": "./logs"
    },
    "config": {
        "WP_DEBUG_LOG": "/var/www/html/wp-content/logs/debug.log"
    }
}

@greenworld

Copy link
Copy Markdown

Thank you @dannyvankooten this helped !
👍

and yes, i'm on Linux (and wp-env uses docker under the hood)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment