Attention
TYPO3 v9 has reached its end-of-life September 30th, 2021 and is not maintained by the community anymore. Looking for a stable version? Use the version switch on the top left.
You can order Extended Long Term Support (ELTS) here: TYPO3 ELTS.
The LogRecord Model¶
All logging data is modeled using \TYPO3\CMS\Core\Log\LogRecord.
This model has the following properties:
- requestId
A unique identifier for each request which is created by the TYPO3 bootstrap.
- created
The micro-timestamp when the record is created.
- component
The name of the logger which created the LogRecord, usually the fully qualified class name where the Logger has been instantiated.
- level
An integer severity level from \TYPO3\CMS\Core\Log\LogLevel.
- message
The log message string.
- data
Any additional data, encapsulated within an array.
The API to create a new instance of LogRecord is
\TYPO3\CMS\Core\Log\Logger:log() or one of the shorthand methods.
LogRecord implements the ArrayAccess interface so that the properties
can be accessed like a native array, for example: $logRecord['requestId'].
It also implements a __toString() method for your convenience,
which returns the log records as a simplified string.
A LogRecord can be processed using LogProcessors
or LogWriters. LogProcessors are meant to add values
to the data property of LogRecord. For example,
if you would like to add a stack trace, use
\TYPO3\CMS\Core\Log\Processor\IntrospectionProcessor.
LogWriters are used to write a LogRecord to a particular target,
for example a log file.