• Resolved auxo

    (@auxo)


    Hi Alex,

    I hope you’re well and think your plugin is great! It’s really helped me troubleshoot a few issues, with the PHP logging.

    Unfortunately Javascript logs are not appearing at all. I’ve setup Sentry and the WP Sentry plugin, however when I send a test error from the your plugin:

    • PHP errors show up
    • Javascript errors do not appear. Here I have:
      — Clicked on “Send Browser Test Event” and “Send Browser Test Error” on my wordpress website
      — I get a notification at the top of the page stating Browser test sent successfully, event ID: xxxxx! (I’ve redacted the actual ID)
      — However, when I look on Sentry, nothing appears, despite having waited.

    I’ve gone over all your documentation, as well as the support forum here. I’ve ensured the following:

    • Added code to wp-config.php
    • Code is above the “That’s all, stop editing!” line
    • I’m below the Sentry limits
    • Setup loading Sentry before WordPress in the wp-config (ensured to add this code, below any configuration options like WP_SENTRY_PHP_DSN). Here, I’ve ensure the file is present at: /wp-content/plugins/wp-sentry-integration/wp-sentry.php
    • Capturing plugin errors, by creating the file: /wp-content/mu-plugins/wp-sentry-integration.php and adding the code specified in your documentation.

    Details on how I setup WP Sentry:

    • Installed and activated the plugin WP Sentry plugin from the WordPress plugin repository
    • Added in the following code to my wp-config.php file:
      (I’ve redacted parts of the DSN from the code below)
    // Sentry PHP tracking
    define( 'WP_SENTRY_PHP_DSN', 'https://xxxxx.ingest.us.sentry.io/xxxxx' );
    
    define( 'WP_SENTRY_ERROR_TYPES', E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_USER_DEPRECATED & ~E_USER_NOTICE );
    
    // Sentry Browser Javascript tracking
    define( 'WP_SENTRY_BROWSER_DSN', 'https://xxxxx.ingest.us.sentry.io/xxxxx' );
    // You can _optionally_ enable or disable the JavaScript tracker in certain parts of your site with these constants:
    define('WP_SENTRY_BROWSER_ADMIN_ENABLED', true);    // Add the JavaScript tracker to the admin area. Default: true
    define('WP_SENTRY_BROWSER_LOGIN_ENABLED', true);    // Add the JavaScript tracker to the login page. Default: true
    define('WP_SENTRY_BROWSER_FRONTEND_ENABLED', true); // Add the JavaScript tracker to the front end. Default: true
    define( 'WP_SENTRY_ENV', 'production' );    // Define an environment of your site. Defaults to the WordPress environment
    require_once __DIR__ . '/wp-content/plugins/wp-sentry-integration/wp-sentry.php';   // Loading Sentry before WordPress
    • Ensured that the code has been added above: /* That's all, stop editing! Happy publishing. */
    • I’ve triple checked the DSN is correct to what is shown on sentry.io, located under Project > SDK Setup > Client Keys (DSN)

    My setup on Sentry.io was as follows:

    • Created one project for “PHP”
    • Created another project for “Browser Javascript”, I’ve not selected any it any further and left the default settings to be placed
    • I’ve double checked DSN is correct

    My PHP version is: PHP 8.0 (ea-php80)

    I’d super appreciate your help, as to why the browser javascript logging is not working.

    Many thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author stayallive

    (@stayallive)

    First of all, I’m very impressed by your report! Thanks for taking the time to first of all research the troubleshooting steps and letting me know how they went, this saves massive amounts of time.

    However, since you tried and done almost everything I would also have suggested that doesn’t leave much, but I’m sure we will figure it out!

    The first thing that comes to mind, do you have an adblocker? Unfortunately they block most requests to Sentry and might be the cause, that would also explain the success message since when an adblocker blocks te request an event ID is still returned indicating the event was sent. If you do, try to disable it completely and test again.

    If you don;t have an adblocker or disabling it has no effect, you can try opening your browsers devtools and see if there are any (network) errors visible when clicking the test buttons.

Viewing 1 replies (of 1 total)

The topic ‘PHP Logging, Java Not Logging’ is closed to new replies.