News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Empty error log

Started by casey_mrc, October 29, 2024, 07:44:32 PM

Previous topic - Next topic

Aleksi "Lex" Kilpinen

Simple test to see if SMF error log works:
Try to log in, with a deliberately wrong password.
If your error logging is working, this should be logged as a user error.

Simple test to see if your server error log works:
Create a file called test.php with something like this
<?php

require_once('/imaginary/test.foo.bar');

?>

And try to access the file on your server. It should error out, and it should get logged as 500 error in your server's error log.

If your SMF error log is not working, perhaps try to disable error logging, and enabling it again.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

casey_mrc

Quote from: Aleksi "Lex" Kilpinen on October 30, 2024, 11:36:15 AMSimple test to see if SMF error log works:
Try to log in, with a deliberately wrong password.
If your error logging is working, this should be logged as a user error.

No error generated.

Aleksi "Lex" Kilpinen

Then I'd suggest you to disable the SMF Error log, save changes, empty your forum file cache, and then enable the error logging again.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

casey_mrc

Sorry, lack of knowledge/experience here.

Yes, I can create the test.php file.

Place it where, FTP to forum folder on server?

Access how, via browser or? 

casey_mrc

Quote from: Aleksi "Lex" Kilpinen on October 30, 2024, 11:45:52 AMThen I'd suggest you to disable the SMF Error log, save changes, empty your forum file cache, and then enable the error logging again.

Yep, I'll try that.....

Aleksi "Lex" Kilpinen

Just upload it in the same folder where your forum files are, and point your browser to it.
If your forum is domain.tld/index.php this should then be domain.tld/test.php
If you receive a blank white page, it should have caused an error to be logged in the server error log.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

casey_mrc

Quote from: Aleksi "Lex" Kilpinen on October 30, 2024, 11:51:36 AMJust upload it in the same folder where your forum files are, and point your browser to it.
If your forum is domain.tld/index.php this should then be domain.tld/test.php
If you receive a blank white page, it should have caused an error to be logged in the server error log.

Done

Blank page with:

Warning: require_once(/imaginary/test.foo.bar): failed to open stream: No such file or directory in /home/sites/31a/e/ed77b10c29/public_html/forum/test.php on line 3

Fatal error: require_once(): Failed opening required '/imaginary/test.foo.bar' (include_path='.:/usr/share/pear') in /home/sites/31a/e/ed77b10c29/public_html/forum/test.php on line 3

No error logged

Aleksi "Lex" Kilpinen

Yeah, a fatal error should really get logged. Like, always. I can't really think of a reason not to log that.

But - that, and the SMF error log not working should still also be 2 different things.
And should be approached separately.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

casey_mrc

Quote from: casey_mrc on October 30, 2024, 11:49:29 AM
Quote from: Aleksi on October 30, 2024, 11:45:52 AMThen I'd suggest you to disable the SMF Error log, save changes, empty your forum file cache, and then enable the error logging again.

Yep, I'll try that.....

Can you confirm the method to clear the cache. Presumably I can simply delete contents of cache folder in "forum" folder using FTP or StackCP file manager? Or, is there a way of clearing via SMF in admin somewhere?

Aleksi "Lex" Kilpinen

You can manually empty the folder, but it is also possible through Admin -> Maintenance -> Forum Maintenance -> Routine -> Empty SMF's cache
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

casey_mrc

Quote from: Aleksi on October 30, 2024, 11:59:35 AMYeah, a fatal error should really get logged. Like, always. I can't really think of a reason not to log that.

But - that, and the SMF error log not working should still also be 2 different things.
And should be approached separately.

To be clear, no error log in SMF admin panel, but StackCP error log shows:

Quotemazdarotaryclub.com [Wed Oct 30 15:56:13 2024] [error] [client 217.39.39.62:0] AH01071: Got error 'PHP message: PHP Fatal error:  require_once(): Failed opening required '/imaginary/test.foo.bar' (include_path='.:/usr/share/pear') in /home/sites/31a/e/ed77b10c29/public_html/forum/test.php on line 3'

casey_mrc

Before I clear the cache, I had a look in there and spotted a small file, "db_last_error.php"

The code on there is:

Quote<?php
$db_last_error = 1727859477;
?>

Is this related to the 16 million ID limit?

Aleksi "Lex" Kilpinen

No, that's just a timestamp. Not related.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

casey_mrc

I don't think it is a timestamp, or it's a massive coincidence (I didn't clear the cache in the end).

FIXED!!!!!

I changed the value in "db_last_error.php" in the cache folder to 2 and I am getting error logs recorded  :)

Thanks for your help guys. It does seem it was related to the AUTO_INCREMENT value exceeding the max limit?

I hope this topic might help anyone else with this issue.

Aleksi "Lex" Kilpinen

Well, it is literally a timestamp and translates to Wed Oct 02 2024 08:57:57 GMT+0000. So, no I do not believe that was what fixed it.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

casey_mrc

Well that is weird.

I'm tempted to put the large value back and see what happens?

Aleksi "Lex" Kilpinen

#36
Go ahead. That file holds the time and date for the last database error. I think the more likely explanation is what I suggested earlier, disabling the log and enabling it again.

For future reference, there's also basically no risk in emptying the cache - It will then just rebuild itself. It is temporary storage.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

casey_mrc

You are correct. I put the "timestamp" value back and I'm still getting logs.

There are only 2 actions I took:

1. Disabled SMF error logging, saved it, renabled it, saved it, did a login "fail". I did this TWICE, no logs created.
2. I tried the SMF cache clear method (I also selected "clear unimportant logs", thinking it couldn't do any harm), but FTP'd in and noted the forum cache had not been cleared. I was about to manually clear the files when I spotted the db_last_error.php file. I edited that, ran a login fail check and noted the error had appeared in the SMF log and (obviously) the SQL table.

Weird, but it was following your advice that led to a solution, so thank you.

Thank you also to EVERYONE who very helpfully, and promptly, responded with advice of how to solve this issue.

Advertisement: