CodeIgniter Forums
logging a global data - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: logging a global data (/showthread.php?tid=71688)



logging a global data - richb201 - 09-13-2018

I am about to go into alpha on my project which is a multi user system and is fairly complex (to me). I figure I will need to turn off and on a log for a specific user who is reporting an issue. But what can I log? I'd like to log the variables each time a function in a controller is called. Is there any type of help built into CI for logging?


RE: logging a global data - ignitedcms - 09-13-2018

*Edited reply see below.


RE: logging a global data - richb201 - 09-13-2018

Thanks. I am already logging errors. I am not talking about that. I want to log variables for my debugging logic. Remember this is multi user so I need to be sure I keep each person's data separate. I would not be super surprised if problems arise in testing. I'd like to write out user data.


RE: logging a global data - ignitedcms - 09-13-2018

I suppose you could write something inside your method/function(s) that saves to a database or text file?

https://stackoverflow.com/questions/24979650/codeigniter-user-tracking-for-visitors

There might be some existing stuff on github but I'm not sure how up to date they are.


RE: logging a global data - php_rocs - 09-13-2018

@richb201,

The documentation link... https://www.codeigniter.com/user_guide/general/errors.html?highlight=logging#error-handling


RE: logging a global data - richb201 - 09-13-2018

It seems that log_message might work if I set the parameter to "info". But I want to log this information to a different file than the error.log.


RE: logging a global data - php_rocs - 09-13-2018

@richb201,

This might be helpful... https://stackoverflow.com/questions/9971305/customize-log-filename-of-codeigniter-log-message