Welcome Guest, Not a member yet? Register   Sign In
Can't write a log message.
#1

Hi, I try to write a log message like this:

   
PHP Code:
public function test()
    {
        log_message('error''Some variable was correctly set');
        echo 'test';
    

When I access that route I fine test message but I see no log. It doesn't over the threshold since I clear the log folder already. I can see an error log if my code got some error but not when I try to trigger using this code. Thanks.
Reply
#2

Make sure the writable folder is really writable and your log threshold is set to 4 or higher.
See https://codeigniter.com/user_guide/general/logging.html
and https://github.com/codeigniter4/CodeIgni...Logger.php
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#3

I did already, I set it to 10 and it currently has 3 logs already, so I assume it's already writeable right? I'm really confused, I already read the docs and it said I just write log_message('error', 'Some variable was correctly set'); or did I miss something?
Reply
#4

Never mind, when I take a look at common.php it said environment must be 'testing', I think you guys suppose to put that on documentation so a newcomer doesn't have to get into this trouble.
Reply
#5

(This post was last modified: 06-19-2022, 02:05 PM by kenjis.)

(06-19-2022, 11:05 AM)Eko Wrote: Never mind, when I take a look at common.php it said environment must be 'testing', I think you guys suppose to put that on documentation so a newcomer doesn't have to get into this trouble.

What do you mean?

(06-18-2022, 07:21 AM)Eko Wrote: I did already, I set it to 10 and it currently has 3 logs already, so I assume it's already writeable right?

There is no `10`. The max number is `9`.
See https://github.com/codeigniter4/CodeIgni...hp#L19-L30
Reply




Theme © iAndrew 2016 - Forum software by © MyBB