Jump to the post that solved this thread.
Solved: 1 Year, 9 Months ago Create an error to test logging
#1
Solved: 1 Year, 9 Months ago
As title says, I want to create a MyBB PHP error to verify an error log is written. I'm not certain permissions are correct. Admin CP configuration is for log and email, warnings and errors to ./error.log This file does not exist at this time. I can easily modify a core file temporarily if necessary.

1. Do I need to create the empty log file for this function to work?
2. Or, are the following errors outside the scope of MyBB error logging?

The server log shows 2 lines of "PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2630545 bytes) in /home/account/public_html/forum/search.php on line 844"

Another instance shows 6 lines of "PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 9437184 bytes) in /home/account/public_html/forum/inc/functions_search.php on line 1697"

Neither memory allocation errors are dated but are sandwiched between other log entries. The first occurred between Dec 22 and Dec 20, while the second one occurred between Dec 8 and Dec 15.

Server was put into production status on December 7th.

Some PHP info:
PHP 7.4.13
display_errors On
max_file_uploads 20
memory_limit 128M
post_max_size 16M
report_memleaks On
upload_max_filesize 8M

Currently running 1.8.21, preparing to update to 1.8.24
[edit to add] forum content is graphic heavy. A post may have 50 images, a thread may have 3 or 4 such posts interspersed with commentary.
Reply
#2
Solved: 1 Year, 9 Months ago
Simply create a test.php at the root:
<?php
call_a_missing_function();
exit;

and call the file from browser.

You will get a 500 Error and the error_log file will be created with the content like:
[28-Dec-2020 14:09:24 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function call_a_missing_function() in /home/account/public_html/forum/test.php:2
Stack trace:
#0 {main}
  thrown in /home/account/public_html/forum/test.php on line 2
Reply
#3
Solved: 1 Year, 9 Months ago
Oddly, the configuration specifies ./error.log as the destination. An existing empty file error_log was there from the previous server in 2019. I changed permissions to 666 and the error was not logged. Then I changed permissions to 777 and it was, then when I changed permissions back to 666 errors continue to be logged.

Now working as expected. Hopefully the memory error will be logged with a timestamp, so I can evaluate the problerm.

Thank you, effone.
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)