LogManager implements SingletonInterface, LogManagerInterface
Global LogManager that keeps track of global logging information.
Inspired by java.util.logging
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
- LogManagerInterface
- LogManager Contract for delivering log instances.
Constants
- CONFIGURATION_TYPE_PROCESSOR : string = 'processor'
- CONFIGURATION_TYPE_WRITER : string = 'writer'
Properties
- $loggers : array<string|int, mixed>
- Loggers to retrieve them for repeated use.
- $requestId : RequestId
- Unique ID of the request
- $rootLogger : Logger
- Default / global / root logger.
Methods
- __construct() : mixed
- getLogger() : Logger
- Gets a logger instance for the given name.
- getLoggerNames() : array<string|int, mixed>
- For use in unit test context only.
- registerLogger() : mixed
- For use in unit test context only.
- reset() : mixed
- For use in unit test context only. Resets the internal logger registry.
- addRequestIdProcessorToLogger() : void
- Attaches the request id processor for all severity levels covered by the configured writers of the given logger. The processor is registered before any configured processor and on purpose not via $TYPO3_CONF_VARS['LOG'], so log records are guaranteed to carry the request id, even if the global processor configuration is overridden. Registering it for exactly the most verbose writer level avoids raising the minimum log level, which would create and process log records no writer ever receives.
- getConfigurationForLogger() : array<string|int, mixed>
- Returns the configuration from $TYPO3_CONF_VARS['LOG'] as hierarchical array for different components of the class hierarchy.
- makeLogger() : Logger
- Instantiates a new logger object, with the appropriate attached writers and processors.
- setProcessorsForLogger() : mixed
- Appends the processors to the given logger as configured.
- setWritersForLogger() : mixed
- Appends the writers to the given logger as configured.
Constants
CONFIGURATION_TYPE_PROCESSOR
public
string
CONFIGURATION_TYPE_PROCESSOR
= 'processor'
CONFIGURATION_TYPE_WRITER
public
string
CONFIGURATION_TYPE_WRITER
= 'writer'
Properties
$loggers
Loggers to retrieve them for repeated use.
protected
array<string|int, mixed>
$loggers
= []
$requestId
Unique ID of the request
protected
RequestId
$requestId
$rootLogger
Default / global / root logger.
protected
Logger
$rootLogger
Methods
__construct()
public
__construct([RequestId $requestId = new RequestId() ]) : mixed
Parameters
getLogger()
Gets a logger instance for the given name.
public
getLogger([string $name = '' ]) : Logger
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class)->getLogger('main.sub.subsub');
$name can also be submitted as a underscore-separated string, which will be converted to dots. This is useful to call this method with CLASS as parameter.
Parameters
- $name : string = ''
-
Logger name, empty to get the global "root" logger.
Return values
Logger —Logger with name $name
getLoggerNames()
For use in unit test context only.
public
getLoggerNames() : array<string|int, mixed>
Return values
array<string|int, mixed>registerLogger()
For use in unit test context only.
public
registerLogger(string $name) : mixed
Parameters
- $name : string
reset()
For use in unit test context only. Resets the internal logger registry.
public
reset() : mixed
addRequestIdProcessorToLogger()
Attaches the request id processor for all severity levels covered by the configured writers of the given logger. The processor is registered before any configured processor and on purpose not via $TYPO3_CONF_VARS['LOG'], so log records are guaranteed to carry the request id, even if the global processor configuration is overridden. Registering it for exactly the most verbose writer level avoids raising the minimum log level, which would create and process log records no writer ever receives.
protected
addRequestIdProcessorToLogger(Logger $logger) : void
Parameters
- $logger : Logger
getConfigurationForLogger()
Returns the configuration from $TYPO3_CONF_VARS['LOG'] as hierarchical array for different components of the class hierarchy.
protected
getConfigurationForLogger(string $configurationType, string $loggerName) : array<string|int, mixed>
Parameters
- $configurationType : string
-
Type of config to return (writer, processor)
- $loggerName : string
-
Logger name
Tags
Return values
array<string|int, mixed>makeLogger()
Instantiates a new logger object, with the appropriate attached writers and processors.
protected
makeLogger(string $name) : Logger
Parameters
- $name : string
Return values
LoggersetProcessorsForLogger()
Appends the processors to the given logger as configured.
protected
setProcessorsForLogger(Logger $logger) : mixed
Parameters
- $logger : Logger
-
Logger to configure
setWritersForLogger()
Appends the writers to the given logger as configured.
protected
setWritersForLogger(Logger $logger) : mixed
Parameters
- $logger : Logger
-
Logger to configure