2 namespace TYPO3\CMS\Core\Log\Writer;
17 use TYPO3\CMS\Core\Log\Exception\InvalidLogWriterConfigurationException;
62 parent::__construct($options);
63 if (empty($options[
'logFile'])) {
118 $timestamp = date(
'r', (
int)$record->
getCreated());
121 $recordData = $record->
getData();
122 if (!empty($recordData)) {
125 if (isset($recordData[
'exception']) && $recordData[
'exception'] instanceof \
Exception) {
126 $recordData[
'exception'] = (string)$recordData[
'exception'];
128 $data =
'- ' . json_encode($recordData);
132 '%s [%s] request="%s" component="%s": %s %s',
141 if (
false === fwrite(self::$logFileHandles[$this->logFile], $message . LF)) {
142 throw new \RuntimeException(
'Could not write log record to log file', 1345036335);
156 if (is_resource(self::$logFileHandles[$this->logFile])) {
161 self::$logFileHandles[
$this->logFile] = fopen($this->logFile,
'a');
162 if (!is_resource(self::$logFileHandles[$this->logFile])) {
163 throw new \RuntimeException(
'Could not open log file "' . $this->logFile .
'"', 1321804422);
174 if (is_resource(self::$logFileHandles[$this->logFile])) {
175 fclose(self::$logFileHandles[$this->logFile]);
176 unset(self::$logFileHandles[$this->logFile]);
188 if (file_exists($this->logFile)) {
191 $logFileDirectory = dirname($this->logFile);
192 if (!@is_dir($logFileDirectory)) {
210 if (!empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'generateApacheHtaccess']) && !file_exists($htaccessFile)) {
213 <IfModule !mod_authz_core.c>
220 <IfModule mod_authz_core.c>
238 return sprintf($this->defaultLogFileTemplate, substr(
GeneralUtility::hmac($this->defaultLogFileTemplate,
'defaultLogFile'), 0, 10));