Welcome Guest, Not a member yet? Register   Sign In
Exception details in log
#1

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)
in SYSTEMPATH/Language/Language.php on line 197.
1 [internal function]: CodeIgniter\Debug\Exceptions->shutdownHandler()
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.
Reply
#2

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>
    ServerAdmin webmaster@joesoapdev
    DocumentRoot "/srv/http/joesoapdev/public"
    ServerName joesoapdev
    ServerAlias joesoapdev
    ErrorLog "/var/log/httpd/joesoapdev-error_log"
    CustomLog "/var/log/httpd/joesoapdev-access_log" common

    <Directory "/srv/http/joesoapdev/public">
       Order allow,deny
    Allow from All
    AllowOverride All
    Require all granted
    </Directory>
</VirtualHost>
CMS CI4     I use Arch Linux by the way 

Reply
#3

(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 :
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>
    ServerAdmin webmaster@joesoapdev
    DocumentRoot "/srv/http/joesoapdev/public"
    ServerName joesoapdev
    ServerAlias joesoapdev
    ErrorLog "/var/log/httpd/joesoapdev-error_log"
    CustomLog "/var/log/httpd/joesoapdev-access_log" common

    <Directory "/srv/http/joesoapdev/public">
  Order allow,deny
Allow from All
AllowOverride All
Require all granted
    </Directory>
</VirtualHost>
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.
Reply
#4

in .env do you have threshhold to 9
Code:
#--------------------------------------------------------------------
# LOGGER
#--------------------------------------------------------------------

logger.threshold = 9

what is i see in /writable/logs looks quite verbose
CMS CI4     I use Arch Linux by the way 

Reply
#5

(10-25-2023, 09:44 AM)captain-sensible Wrote: in .env do you have threshhold to 9
Code:
#--------------------------------------------------------------------
# LOGGER
#--------------------------------------------------------------------

logger.threshold = 9

what is i see in /writable/logs looks quite verbose

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.
Reply
#6

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

[Wed Oct 25 05:17:38.522518 2023] [php:error] [pid 1171112] [client ***] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /var/www/public_html/system/Debug/ExceptionHandler.php on line 1

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.
Reply
#7

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
CMS CI4     I use Arch Linux by the way 

Reply
#8

(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 .

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

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.
Reply
#9

what is on line 197 of Language.php ?
CMS CI4     I use Arch Linux by the way 

Reply
#10

(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);
        if ($formatted === false) {
            throw new InvalidArgumentException(
                lang('Language.invalidMessageFormat', [$message, implode(',', $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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB