Exception details in log |
Hi!
I keep finding that the log messages do not tell me much about where the error is coming from. For example, I found this error in our logs: Quote:CRITICAL - 2023-10-25 05:17:38 --> Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)How can I get the log message to tell me which URL/page was accessed that caused this error? It would allow me to better debug and figure out what is triggering this.
well depends on your dev setup but mine is apache on Arch Linux in /var/log/httpd i have :
Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /srv/http/joesoapdev/app/Views/navbar.php on line 1 I enabled that in a vhost file located /etc/httpd/conf/vhosts with entries Code: <VirtualHost 127.0.0.3:80> (10-25-2023, 06:09 AM)captain-sensible Wrote: well depends on your dev setup but mine is apache on Arch Linux in /var/log/httpd i have :Thanks for that. That is useful and something I can do; I was just wondering if CI had a native way to update their log files with the page that is being accessed.
in .env do you have threshhold to 9
Code: #-------------------------------------------------------------------- what is i see in /writable/logs looks quite verbose (10-25-2023, 09:44 AM)captain-sensible Wrote: in .env do you have threshhold to 9 No I only set to critical/fail errors as this error was caught on our production server. If I set to 9, the log file will be spammed and generate to an enormous size.
I found the error in my apache log:
Quote:[Wed Oct 25 05:17:38.520100 2023] [php:error] [pid 1171112] [client ***] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/public_html/system/Language/Language.php on line 197 Not really sure where to go from here since these are system files and it doesn't really tell me what page was accessed to cause it.
i would be tempted to "rsync " the whole production CI4 directory which you can do remote to local . Your server is linux looks like. So install same to a PC. Go for equivalent web server Apache or what ever .
Dump MySQl or other db if need be into a file and import it local. So basically duplicate everything from live and use your local as your test bed for everything , then you can make changes if there all good on local to live server (10-26-2023, 01:51 AM)captain-sensible Wrote: i would be tempted to "rsync " the whole production CI4 directory which you can do remote to local . Your server is linux looks like. So install same to a PC. Go for equivalent web server Apache or what ever . I already have a dev server and use git to push changes. I haven't seen this error occur on my dev server ever so still not sure how to debug. When I push to live, it gets 10k+ users a day so trying to figure out whatever specific issue is causing it can be quite hard lol.
(10-26-2023, 02:09 AM)captain-sensible Wrote: what is on line 197 of Language.php ? https://github.com/codeigniter4/CodeIgni...nguage.php Quote:$formatted = MessageFormatter::formatMessage($this->locale, $message, $args);I don't really use any locale functions on my site, so I'm assuming this is something to do with system-wide language support like pagination or something. But hard to figure out based on the error message. |
Welcome Guest, Not a member yet? Register Sign In |