/** * Returns a log file path and name relative to the assets folder using config.log_path. If path doesn't exist * and is in the assets folder then will try and create it (recursively). If it is outside * the assets folder then will not try and create the path. * * @return string * @throws \Modular\Exceptions\Application */ protected function makeLogFileName() { if ($filePathName = static::config()->get('log_file')) { // if no path then dirname returns '.' we don't want that but empty path instead $path = trim(dirname($filePathName), '.'); if (!$path) { $path = static::config()->get('log_path'); } $fileName = basename($filePathName, '.log'); } else { $path = static::config()->get('log_path'); $date = date('Ymd_his'); $prefix = $this->source ?: "{$date}-"; $fileName = basename(tempnam($path, "silverstripe-{$prefix}")) . ".log"; } $path = Application::make_safe_path($path, false); return "{$path}/{$fileName}.log"; }