PHP Errors in sage is not being logged or displayed

I am trying to get the error displayed when working with sage 9. Sage won’t throw the error as HTML or log it in debug.log.

At first I thought my WP_DEBUG setup would be wrong but I checked with other plugins and the error from those file does actually throw an error.

What I tried.

I added the following in front-page.blade.php

@php  throw new Exception("Something broke!");  @endphp

It just returns: There has been a critical error on your website.

I also tried installing this:

But it doesn’t work for me. Can you help me fix this, because without the error its very difficult to develop. :face_with_hand_over_mouth:

in your wp-config, if WP_DEBUG & WP_DEBUG_LOG are true, you should be able to identify errors through debug.log file.

@yeah, It doesn’t log for errors which rise in sage.

really, idk if i can help you, but i’m curious about your problem and i’d like to understand your needs, so i put your code on a template page.

This is my output, on both website & debug.log
are you looking for that?

[30-Jul-2020 08:56:37 UTC] PHP Fatal error: Uncaught Exception: Something broke! in /Applications/AMPPS/www/demo.test/wp-content/uploads/cache/66d022d94dc5868bff4ac95b352407322d81dc47.php:7

Stack trace:

#0 /Applications/AMPPS/www/demo.test/wp-content/themes/demo/vendor/illuminate/view/Engines/PhpEngine.php(43): include()

#1 /Applications/AMPPS/www/demo.test/wp-content/themes/demo/vendor/illuminate/view/Engines/CompilerEngine.php(59): Illuminate\View\Engines\PhpEngine->evaluatePath(’/Applications/A…’, Array)

#2 /Applications/AMPPS/www/demo.test/wp-content/themes/demo/vendor/illuminate/view/View.php(142): Illuminate\View\Engines\CompilerEngine->get(’/Applications/A…’, Array)

#3 /Applications/AMPPS/www/demo.test/wp-content/themes/demo/vendor/illuminate/view/View.php(125): Illuminate\View\View->getContents()

#4 /Applications/AMPPS/www/demo.test/wp-content/themes/demo/vendor/illuminate/view/View.php(90): Illuminate\View\View->renderContents()

#5 /Applicati in /Applications/AMPPS/www/demo.test/wp-content/uploads/cache/66d022d94dc5868bff4ac95b352407322d81dc47.php on line 7

@yeah Thanks a lot. I really appreciate the effort.

I don’t see these output when I run the code. I just see the generic wordpress error message which is not the case when I mistake in my plugins code.

I will keep trying and post if I find anything.

You’re welcome.
Check your php settings, maybe display_errors on/off.

@yeah it doesnt help.

I tried using error_log("test"); and it is successfully loggin my errors.

But intrestingly it won’t show on the HTML.

My setting inside config.php is :

@ini_set( 'upload_max_filesize' , '512M' );
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', true);

I still was not able to find the issue why I couldn’t see error logs. But I have found an alternate way to use start debugging PHP.

This is an awesome plugin called UPDEVTOOL which I think should be used by everyone.

Go through this GitHub - KnowTheCode/UpDevTools: UpDevTools - A suite of developer tools for your WordPress development environment installation method.

You would get error screens like laravel.

I think this should be used by every other WordPress developer.

1 Like

Hi @Bhanu_Kumar_Singh, nice to see you solved your problem.
About UpDevTools, first time i heard about it. But i got experienced with whoops on laravel, and it’s very clear and useful.

1 Like

This topic was automatically closed after 42 days. New replies are no longer allowed.