Hi all,

I used to check the apache error log for php errors generated by drupal.
With backdrop, these errors do not seem to be added to the apache error log. Is that right?

Where could they be now? Using Macosx.

 

Thanks!

Accepted answer

Directive "display_errors = on" intended to show errors on screen - and it works as you can see.

You can try to use custom log file.

Under /var/log/ create new directory "php" and make it writable by Apache.

Add to php.ini directives:

log_errors = On

error_log = /var/log/php/errors.log

Restart Apache and try to generate error on application level, for example in "index.php"

Please note: php warnings/errors from template level always logged by Backdrop
and can be checked at http(s)://your.site/admin/reports/dblog.

Additionally, you can set logging level at http(s)://your.site/admin/config/development/logging to "All messages" and get more info on development stage.

Happy debugging!

Comments

Apache manages "apache error log for php errors" . Check your apache settings.

For the default Mac OS X Apache installation these are located in: /var/log/apache2/error_log

The location can be changed in the httpd config using the ErrorLog directive , even for individual virtual hosts.

I don't believe that there should be any change between Drupal 7 and Backdrop CMS in how php errors are logged. But, I could be wrong. 

I suspect that you might not have error logging turned on, which I believe would be an apache setting, not anything in Backdrop CMS. 

Hopefully, smarter people that myself can provide more help or you can provide additional information about your problem. 

The display_error = on directive is present in my php.ini file.
In the /var/log/apache2/error_log file nothing is appended.

I'm editing a new theming file for a view, using the Theming information link in Views.
When I - on purpose - make a coding mistake, I get the webpage as you can see in attachment.
But no error is appended to /var/log/apache2/error_log. Which is weird.

 

findlabnet's picture

Directive "display_errors = on" intended to show errors on screen - and it works as you can see.

You can try to use custom log file.

Under /var/log/ create new directory "php" and make it writable by Apache.

Add to php.ini directives:

log_errors = On

error_log = /var/log/php/errors.log

Restart Apache and try to generate error on application level, for example in "index.php"

Please note: php warnings/errors from template level always logged by Backdrop
and can be checked at http(s)://your.site/admin/reports/dblog.

Additionally, you can set logging level at http(s)://your.site/admin/config/development/logging to "All messages" and get more info on development stage.

Happy debugging!

Thanks for all the help already. Knowing that the template errors can be found on the site itself is great. That's new to me.
Although I can debug everything now on screen, I can't seem to get php to write errors to a log file.

log_errors = On
error_log = /var/log/php/error_log

And the directory is chmod 777. I even created an empty error_log file with all permissions. But nothing is appended.

First I thought I was changing the wrong php.ini file, but when I do display_errors = Off, they don't show on screen anymore. So that one works.

Nothing fatal here, but it bugs me. ;-)

Anyway, thanks for all the help!

A last note.
It seems that application level errors are appended to /var/log/apache2/error_log
Changing the location of the log in php.ini doesn't work, but that's ok.
It's just the template level errors that are not appended to the log, but I can find those on the site itself.
All set here. :)

If you want to see the errors that are going to dblog in a log file (because you can tail it, for instance) you might try enabling syslog.

findlabnet's picture

>> Changing the location of the log in php.ini doesn't work

- but there are no miracles ;-)

Please make sure you edit right php.ini (you have at least two in your system).

You can navigate to http(s)://your.site/admin/reports/status/php,

then search "php.ini" as "Loaded Configuration File" and "error_log".

And don't forget restart Apache after changes.