1

I need to create debug.log, but for some reason it was not created.

Things I've tried:

  1. Installing plugin that should allow logging, to create history of my problems.
  2. editing wp-config.php with debug lines:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );
define( 'WP_DEBUG_LOG', '/tmp/wp-errors.log' );

I hope it ends well :D?

3
  • Use define( 'WP_DEBUG_LOG'): define( 'WP_DEBUG', true ); define( 'WP_DEBUG_DISPLAY', false ); A debug.log file will be created in wp-content folder. Commented Oct 24, 2023 at 18:41
  • 1
    thanks I do have a debug.log file now. Commented Oct 24, 2023 at 19:19
  • Also, to solve this problem, try using plugins such as as Admin debug wordpress - enable debug, Issues Tracker or similar Commented Jan 23, 2024 at 19:16

2 Answers 2

2

Before enabling debugging in WordPress, try manually creating the log file /tmp/wp-errors.log with write permissions for the web server user.

touch /tmp/wp-errors.log

chmod 666 /tmp/wp-errors.log

This will ensure that WordPress can write to the log file.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you for your help. However, I am using an FTP terminal that does not recognize the "touch" command, so I have used the "put" command to send this file from my local machine instead. The same situation applies to the "chmod" command. What alternatives are available in this context?
I hope you can create the path /tmp/wp-errors.log. To grant permissions, look for an option such as 'File Permissions,' 'CHMOD,' or 'Set Permissions.' This option may vary depending on your FTP client. In the permissions dialog, set the file permissions to '666' (read and write permissions for owner, group, and others).
Also, remember the file permission "666" is very open and is not recommended for production, only for testing purpose. When you done testing do not forget to set the file permissions to "644"
2

There must have been a group/owner permissions error that prevented WordPress from writing a log file to /tmp/. If you're using a shared server, that's probably the reason; you may not be able to write to /tmp/, or /tmp/ may not exists and you don't have permissions to create it.

Just use in wp-config.php

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true);
define( 'WP_DEBUG_DISPLAY', false );

to let WordPress write the default Debug.log file to /wp-content/.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.