We have been told that this feature is pretty much unkown in the TYPO3 community. A good reason to shed some details on this neat little thing.
Your log configuration might have looked like this in the past:
$GLOBALS['TYPO3_CONF_VARS']['LOG']['Reelworx']['RxShariff']['writerConfiguration'] = [ \TYPO3\CMS\Core\Log\LogLevel::WARNING => [ \TYPO3\CMS\Core\Log\Writer\FileWriter::class => [ 'logFile' => 'typo3temp/var/log/shariff-4vn34.log' ] ] ];
As experienced integrator might identify spot on: This has a tiny little drawback.
The log file path is hardcoded.
Does it matter? We said, yes it does, and the reasons are:
- The location of the
vardirectory varies depending whether it's a classic or composer installation of TYPO3
- From version 8 LTS to 9 LTS the path slighty changed from
Forgot this to migrate while upgrading? You have two log directories now.
- Your log file name does not contain an installation dependent hash for security.
- It is impossible to ship a default log configuration with an extension.
You don't know where the
varfolder might be placed.
Your new configuration simply changes one line:
- 'logFile' => 'typo3temp/var/log/shariff-4vn34.log' + 'logFileInfix' => 'shariff'
This way your final configuration looks like this:
$GLOBALS['TYPO3_CONF_VARS']['LOG']['Reelworx']['RxShariff']['writerConfiguration'] = [ \TYPO3\CMS\Core\Log\LogLevel::WARNING => [ \TYPO3\CMS\Core\Log\Writer\FileWriter::class => [ 'logFileInfix' => 'shariff' ] ] ];
This tells the FileWriter to use the default log file location and name, but add the little extra word shariff into the log file name.
Strike. The log file placement all of a sudden got predictable.
This information applies to TYPO3 version 9 and 10 LTS.