WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How Do I Debug a Plugin? (6 posts)

  1. b-rad
    Member
    Posted 3 years ago #

    I'm trying to get my feet wet and learn how to create a WP plugin but I don't see any way to get some basic debug info to show up. I've set define( 'WP_DEBUG', true ); in my wp-config.php file but all I see are messages like:

    The plugin generated 309 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

    when I activate my test plugin. How can I get more detail including things like the 309 characters Wp tells me it sees?

  2. elfin
    Moderator
    Posted 3 years ago #

    Sometimes you can't get more details, depends on what is causing the error.

    I'd also suggest using define( 'WP_DEBUG_LOG', true ); as well.

  3. b-rad
    Member
    Posted 3 years ago #

    Wow, can't get more details? That seems pretty limiting. Like trying to code with your hands behind your back. I checked out http://codex.wordpress.org/Editing_wp-config.php which says to try changing the config file to:

    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);
    @ini_set('display_errors',0);

    but my log file gets no errors. This is frustrating. There has to be a better way to create a plugin, especially one that deals with db tables.

  4. b-rad
    Member
    Posted 3 years ago #

    Progress made. I changed my config file to:

    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', true);
    @ini_set('display_errors',0);

    and put a debug.log file in my wp-content folder and made it writable by the web server and now I'm actually catching errors.

  5. elfin
    Moderator
    Posted 3 years ago #

    did you manage to solve the issue?

  6. b-rad
    Member
    Posted 3 years ago #

    Yeah, this should do the trick.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags