Page 1 of 1

debug_to_log() always active?

Posted: Sat Jul 23, 2022 8:35 pm
by creopard
Hello,

today, I noticed the file in /tmp/cache/debug.log with today's timestamp.
Since I do not have debug_to_log enabled in the config.php, I wondered, why this file was created anyways.

I found the function in /lib/misc.functions.php with that condition:

Code: Select all

function debug_to_log($var, $title='',$filename = '')
{
    $config = \cms_config::get_instance();
if( $config['debug_to_log'] || (function_exists('get_userid') && get_userid(FALSE)) ) {
This condition is concatenated by "||" (OR) but what is "get_userid()" used for?
Does that mean, the debug.log gets created even it's NOT activated in the config.php file?

Re: debug_to_log() always active?

Posted: Fri Jul 29, 2022 2:22 pm
by creopard
No none got any idea?

Re: debug_to_log() always active?

Posted: Fri Jul 29, 2022 4:02 pm
by Jo Morg
As long as there is someone logged in in the backend, yes, there are a few debug_to_log calls that may still be active in the core and possibly in other 3rd party modules that will create entries for those specific users both in frontend and backend actions. The config entry only affects frontend actions from regular site visitors to prevent it's growth without any particular debugging purpose. Although this as been like that since, well, almost for ever :) I think it's a legit use. We may revise that policy in the future though, if it interferes with a site's performance in any way.

Re: debug_to_log() always active?

Posted: Sat Jul 30, 2022 3:37 pm
by creopard
Thanks for clearing this up, so "get_userid(FALSE)" refers to a logged in user in the admin section?

Re: debug_to_log() always active?

Posted: Sat Jul 30, 2022 3:54 pm
by Jo Morg
That's exactly right!