• Resolved GusGF

    (@gusgf)


    I have followed David Lee’s stackexchange suggestion in reply to another forum member to no avail.
    I’ve followed the WP online documentation on Debugging in WordPress again to no avail. The WP online docs also stops short of telling how you should create user generated messages to the log.

    It really shouldn’t be this difficult should it!! All I want to do is log my own debug messages to a local file.

    Also I notice it says in the above link:

    NOTE: You must insert this BEFORE /* That’s all, stop editing! Happy blogging. */ in the wp-config.php file.

    WHY?
    Is there something looking out for this line and the file is no longer read?
    Can I just pasted stuff above this line?
    No explanation is given for this could someone please enlighten me?

    • This topic was modified 4 years, 1 month ago by GusGF.
    • This topic was modified 4 years, 1 month ago by GusGF.
Viewing 2 replies - 1 through 2 (of 2 total)
  • To write to a log file yourself, you need to use error_log
    https://www.php.net/manual/en/function.error-log

    When you set the appropriate constants in the wp-config.php file, the messages generated by PHP will either be displayed (which can mess up your layout) or written to the debug log (which is easier to see, all in a sequence, but separate from your user interaction).

    And yes, the comment in the wp-config.php file is the reference point so that people know where to define constants and not mess up the loading of WP.
    This is an in-depth explanation of the constants: https://www.ads-software.com/support/article/editing-wp-config-php/

    Thread Starter GusGF

    (@gusgf)

    Thank you managed to get this working from the links provided. Essentially putting the following code in wp-config.php

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

    And referencing ‘debug.log’ in wp-content.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to generate debug messages for my locally hosted site’ is closed to new replies.