1

New to wp-env, which is mostly a fantastic dev tool.

{
  "plugins": ["./blinkwellness-mindbody"],
  "config": {
    "WP_DEBUG": true,
    "WP_DEBUG_LOG": true,
    "WP_DEBUG_DISPLAY": true,
    "SCRIPT_DEBUG": true
  },
  "phpVersion": "8.1",
  "mappings": { "profileApp": "./profileApp" },
  "env": {
    "development": {
      "themes": ["./customtheme"]
    },
    "tests": {
      "config": {
        "KEY_1": false
      },
      "port": 3300
    }
  }
}

However, I am having trouble finding error logs. At the moment developing an Ajax feature, which started returning a 500 error.

When running wp-env logs all, the result is:

...523db7a-tests-wordpress-1  | 172.21.0.1 - - \
[16/Feb/2023:13:23:27 +0000] "POST /wp-admin/admin-ajax.php \
HTTP/1.1" 500 484 "http://localhost:3300/schedule/"  \
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 \ 
(KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36

Empty content in /var/log/apache2/error.log.

Only wordpress debug log I'm finding on the server, /var/www/html/wp-content/debug.log, which only has some PHP Deprecated and other warnings in it.

Any suggestions?

UPDATE

Went to another dev approach (Roots/Trellis, virtualbox), which runs Nginx and there indeed the relevant Fatal Error is listed in /var/log/nginx/debug.log.

Where it gets thrown is:

if ( WP_DEBUG ) {
    throw new \Exception( $err->getMessage() );
}

So, maybe there's a different php log level between wp-env and the Trellis virtualbox configuration.

1 Answer 1

1

I added:

trigger_error( ini_get('error_log'), E_USER_WARNING );

which showed:

/dev/stderr

Adding to .wp-env.json:

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

seems to work for me.

Running npx wp-env run cli wp config get WP_DEBUG should return 1 showing that WP_DEBUG is enabled by default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.