{"id":17762477,"date":"2024-05-17T10:09:02","date_gmt":"2024-05-17T10:09:02","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/php-logging-java-not-logging\/"},"modified":"2024-05-17T10:09:02","modified_gmt":"2024-05-17T10:09:02","slug":"php-logging-java-not-logging","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/php-logging-java-not-logging\/","title":{"rendered":"PHP Logging, Java Not Logging"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hi Alex, <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I hope you&#8217;re well and think your plugin is great! It&#8217;s really helped me troubleshoot a few issues, with the PHP logging. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Unfortunately Javascript logs are not appearing at all. I&#8217;ve setup Sentry and the WP Sentry plugin, however when I send a test error from the your plugin:<\/p>\n\n\n\n<ul>\n<li>PHP errors show up<\/li>\n\n\n\n<li>Javascript errors do not appear. Here I have:<br \/>&#8212; Clicked on &#8220;Send Browser Test Event&#8221; and &#8220;Send Browser Test Error&#8221; on my wordpress website<br \/>&#8212; I get a notification at the top of the page stating <code>Browser test sent successfully, event ID: xxxxx!<\/code> (I&#8217;ve redacted the actual ID)<br \/>&#8212; However, when I look on Sentry, nothing appears, despite having waited.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;ve gone over all your documentation, as well as the support forum here. I&#8217;ve ensured the following:<\/p>\n\n\n\n<ul>\n<li>Added code to wp-config.php<\/li>\n\n\n\n<li>Code is above the &#8220;That&#8217;s all, stop editing!&#8221; line<\/li>\n\n\n\n<li>I&#8217;m below the Sentry limits<\/li>\n\n\n\n<li>Setup loading Sentry before WordPress in the wp-config (ensured to add this code, below any configuration options like\u00a0<code>WP_SENTRY_PHP_DSN<\/code>). Here, I&#8217;ve ensure the file is present at: <code>\/wp-content\/plugins\/wp-sentry-integration\/wp-sentry.php<\/code> <\/li>\n\n\n\n<li>Capturing plugin errors, by creating the file: <code>\/wp-content\/mu-plugins\/wp-sentry-integration.php<\/code> and adding the code specified in your documentation.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Details on how I setup WP Sentry:<\/p>\n\n\n\n<ul>\n<li>Installed and activated the plugin WP Sentry plugin from the WordPress plugin repository<\/li>\n\n\n\n<li>Added in the following code to my wp-config.php file: <br \/>(I&#8217;ve redacted parts of the DSN from the code below)<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Sentry PHP tracking\ndefine( 'WP_SENTRY_PHP_DSN', 'https:\/\/xxxxx.ingest.us.sentry.io\/xxxxx' );\n\ndefine( 'WP_SENTRY_ERROR_TYPES', E_ALL &amp; ~E_DEPRECATED &amp; ~E_NOTICE &amp; ~E_USER_DEPRECATED &amp; ~E_USER_NOTICE );\n\n\/\/ Sentry Browser Javascript tracking\ndefine( 'WP_SENTRY_BROWSER_DSN', 'https:\/\/xxxxx.ingest.us.sentry.io\/xxxxx' );\n\/\/ You can _optionally_ enable or disable the JavaScript tracker in certain parts of your site with these constants:\ndefine('WP_SENTRY_BROWSER_ADMIN_ENABLED', true);    \/\/ Add the JavaScript tracker to the admin area. Default: true\ndefine('WP_SENTRY_BROWSER_LOGIN_ENABLED', true);    \/\/ Add the JavaScript tracker to the login page. Default: true\ndefine('WP_SENTRY_BROWSER_FRONTEND_ENABLED', true); \/\/ Add the JavaScript tracker to the front end. Default: true\ndefine( 'WP_SENTRY_ENV', 'production' );    \/\/ Define an environment of your site. Defaults to the WordPress environment\nrequire_once __DIR__ . '\/wp-content\/plugins\/wp-sentry-integration\/wp-sentry.php';   \/\/ Loading Sentry before WordPress<\/code><\/pre>\n\n\n\n<ul>\n<li>Ensured that the code has been added <strong>above<\/strong>: <code><em>\/* That's all, stop editing! Happy publishing. *\/<\/em><\/code><\/li>\n\n\n\n<li>I&#8217;ve triple checked the DSN is correct to what is shown on sentry.io, located under Project &gt; SDK Setup &gt; Client Keys (DSN)<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">My setup on Sentry.io was as follows:<\/p>\n\n\n\n<ul>\n<li>Created one project for &#8220;PHP&#8221;<\/li>\n\n\n\n<li>Created another project for &#8220;Browser Javascript&#8221;, I&#8217;ve not selected any  it any further and left the default settings to be placed<\/li>\n\n\n\n<li>I&#8217;ve double checked DSN is correct<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">My PHP version is: PHP 8.0 (ea-php80)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;d super appreciate your help, as to why the browser javascript logging is not working. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Many thanks!<\/p>\n","protected":false},"template":"","class_list":["post-17762477","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17762477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17762477\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=17762477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}