public function Log($idsTraceLevel, $messageToWrite)
{
$fileToWrite = CoreConstants::DEFAULT_LOGGINGLOCATION . '/executionlog.txt';
if(file_exists($fileToWrite) && is_writable($fileToWrite))
{
file_put_contents($fileToWrite, $messageToWrite."\n", FILE_APPEND);
}
}
However without manual intervention, the log will never be written:
There is no attempt in the codebase to actually create the directory specified by the path constant CoreConstants::DEFAULT_LOGGINGLOCATION which currently refers to "/tmp/IdsLogs".
There is no attempt to actually create the file executionlog.txt.
Since neither the directory nor the file exist and are not created, the log will never be written.
The Log() method should either create the needed directory and file, or it should be documented that this file needs to be manually generated in order to be written.
In src/Diagnostics/LoggerBase.php you have this code for logging diagnostics as described in your documentation:
However without manual intervention, the log will never be written:
CoreConstants::DEFAULT_LOGGINGLOCATION
which currently refers to"/tmp/IdsLogs"
.executionlog.txt
.Since neither the directory nor the file exist and are not created, the log will never be written.
I did this from a shell to get this log working:
The
Log()
method should either create the needed directory and file, or it should be documented that this file needs to be manually generated in order to be written.