I have two Google App Engine Standard env services within a project. The second service (PHP 5.5) is fine, but the 'default' instance has disappeared from Stackdriver Error Reporting after switching the runtime to PHP 7.2 (I think... I'm not definite on the point it disappeared).
'Default' is still available in Stackdriver > Logs Viewer, but while this displays 500 errors, it doesn't provide details of the exception.
'Default' service is missing from the Stackdriver > Error Reporting > 'All services' select input, even if I set the time frame prior to the point it disappeared, much like its been deleted from Stackdriver.
I've worked through https://cloud.google.com/error-reporting/docs/setup/php and added everything relevant except ...
auto_prepend_file='/project-dir/vendor/google/cloud-error-reporting/src/prepend.php'
... as there's nothing in the docs to suggest what /project-dir/ is. I tried setting this to ...
/VENDOR-PARENT-DIR/vendor/google/cloud-error-reporting/src/prepend.php
and
/PROJECT-NAME/VENDOR-PARENT-DIR/vendor/google/cloud-error-reporting/src/prepend.php
... either of which display an error in the browser after deploying, which I assume is related to an error within php.ini. Taking this line out of php.ini and re-deploying resumes normal service.
Is anybody able to provide some pointers, please? I've got a 500 in QA which I can't replicate locally and I'm fumbling in the dark with no error reporting on the GAE instance.
Thanks
Please keep in mind that only errors containing a stack trace will be processed to Stackdriver Error Reporting.The service name will not appear on the dropdown if no log containing a stack trace is generated.
However, you can review all logs on Stackdriver Logging page.
Review the following documentation for more details.
Also review the following documentation for more details on Stackdriver Trace.
Related
So I've just spent quite some time on something that should have been very quick to fix.
I'm on a local environment, with debug set to true. I was working on a php file which implements the Jsonable interface, and I got the compatibility a bit wrong. Unfortunatly, when I ran this file, it simply showed a 500 error and a completely blank, white page, without any errors.
I checked my error log, and that didn't have any errors in it (relating to this issue) either.
I found online that setting debug to true in Laravel hides sets display_errors to 0. I quickly did a ini_set('display_errors', 1) in my called controller and I got the fatal error message I was looking for!
My question is:
How can I display these fatal errors etc (not exceptions) in Laravel when debug is true, without specifying ini_set('display_errors', 1) in all my controllers?! Why does Laravel hide errors when in debug mode anyway?! It's very frustrating having an error which isn't displayed (even when in debug mode), and isn't logged!
Any help is appreciated.
I have a CodeIgniter PHP app running on a Heroku Cedar instance.
We are running a PHP app and we need to log errors, but NOT print them to the screen. No matter what I do, the errors are printing to the screen, which is not safe for production.
Here is the PHP code which works on my local environment and everywhere else (besides Heroku):
error_reporting(E_ALL); #we care about all errors
ini_set('display_errors',0); #but DONT print to screen
I have seen this document which suggested I try adding a custom CodeIgniter logging class, which did not work.
I also added a phpinfo() to the app to check if somehow my settings were being overridden downstream, but it shows that display_errors is set to "Off".
So why am I STILL seeing errors printed on the screen?
It turns out that CodeIgniter 2.x has some completely asinine error handling in which they use a custom error handler to ignore the developers configurations. Apparently this is fixed in v3.
I was able to fix it by just commenting out the custom error handling, which for me was located in in CodeIgniter.php, line 72...
//set_error_handler('_exception_handler');
Or the best solution of all: don't use CodeIgniter in the first place.
I am in the process of migrating codeigniter from centos to ubuntu and after moving the files, adjusting the config files, etc, I am getting the white screen of death. Debugging it, the code seems to die in CodeIgniter.php at
$CI = new $class();
where
$class = welcome
I have confirmed the MySQL is installed and running, both in PHP and on the command line. Additionally, I can't find codeigniter complaining about any errors in either my apache error logs or the codeigniter ones at application/logs. This is despite setting the logging threshold to 4 and setting display errors to true.
the only solution for this issue to find the php error logs,
check it on /var/logs/apache2/errors.log or if you use ssl /var/logs/apache2/ssl_errors.log
this is the default paths for php error log
please check your php error logs for getting the error message.
There's 3 solutions to know where's the problem.
1- Codeigniter offer logs for configure it
go to application/config.php
Change $config['log_threshold'] = 2; //for debug messages
Each request you can find the log messages in
application/logs/..
or
system/logs/..
Don't forget to switch it off after fix your issue by change it to 0 or 1 for display error messages only.
2- Or you can Enable development mode but i prefer the first solution.
if you want to switch to development mode edit index.php in the main project files and change ENVIRONMENT definition to 'development'
this option show errors on the site front.
3- Or you can check the PHP log errors in
/var/log/apache2/error.log
or
/var/log/apache2/ssl_error.log
if you using https
I want to log some messages from my php application in the apache error logs. But I would like this to happen only in the non-production environments.
I found that php has error_log to log messages to the error log file but how do I control it to only log if my application is running in the non-prod environments.
Also, I found that there is trigger_error which takes a error type parameter. And the error_reporting setting in php.ini can then decide which error types are actually logged. So, while in dev, I have error_reporting set to E_ALL , it is more restricted in production. So, now I can use trigger_log and always log at E_USER_NOTICE. This would mean that my message is only shown in the dev log files but not in the production log files.
However, trigger_error also produces a stack trace with every log which is a bit unnecessary for me. How can I disable this stack trace.
Also, am I doing things the right way. How do people generally handle this problem.
Edit:
I am not trying to suppress error messages. I am trying to provide more debug messages in dev. Things like "Request came with following parameters", "step 1 done", etc. This is really not required in production.
If you want just custom messages sent into error log manually, log_error() is the function you are looking for.
Firstly, suppressing error handling is not a good idea - errors have a huge impact on your application performance - and suppressing error reporting does not eliminate the slowdown.
There is no 'trigger_log' in PHP.
The build in error handling in PHP does not generate a stack trace - you must have a custom error handler installed. You need to find it and amend the code if you want to change it's behaviour.
Using 'trigger_error' to record debug events is a very bad idea.
I'm having some problems getting zf2 to log errors or report them under some circumstances.
Some errors will be reported to screen and the error.log but others are not and just result in a blank screen. There doesn't appear to be any reasoning behind what does get displayed and what doesn't.
I have error reporting enabled in my php ini set to E_ALL and I have added
'display_not_found_reason' => true,
'display_exceptions' => true,
to my module config, and I have also tried setting the error reporting values directly in the index.php
At the moment im trying to use doctrine and just getting a blank screen...
https://packagist.org/packages/webino/nette-debug
Link listed above is one of the most useful debug tools I've found so far for zf2. It picks up 99.9% of the errors and the configuration allows you to log it to a specific log file in your directory. However there is that .1% that it doesn't catch and that generally does go through to the syslog so you should be able to find out more details there. Just make sure you initialize the nette debug module as the first module in the stack.
Hope this helps you, I got really sick and tired of those issues too up to the point where where I found nette.