Fix mode SYSLOG_FILE_ONEPERSESSION to work as expected

This commit is contained in:
Laurent Destailleur 2018-06-24 13:59:37 +02:00
parent 25b1d063ae
commit 848c8cdc4b

View File

@ -109,9 +109,16 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
if (empty($conf->global->SYSLOG_FILE)) $tmp=DOL_DATA_ROOT.'/dolibarr.log';
else $tmp=str_replace('DOL_DATA_ROOT', DOL_DATA_ROOT, $conf->global->SYSLOG_FILE);
if (! empty($conf->global->SYSLOG_FILE_ONEPERSESSION)) // file depend on session name (Note that session name is same for all users and is not a per user value)
if (! empty($conf->global->SYSLOG_FILE_ONEPERSESSION))
{
$suffixinfilename = '_'.session_name();
if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 1) // file depend on session key name (Note that session name is same for all users and is not a per user value)
{
$suffixinfilename = '_'.session_name();
}
if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 2) // file depend on session value sor per user
{
$suffixinfilename = '_'.session_name().'_'.$_SERVER["REMOTE_ADDR"];
}
}
return $suffixinfilename?preg_replace('/\.log$/i', $suffixinfilename.'.log', $tmp):$tmp;