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 = 'processor'
- CONFIGURATION_TYPE_WRITER = 'writer'
Properties
- $loggers : array<string|int, mixed>
- Loggers to retrieve them for repeated use.
- $requestId : string
- Unique ID of the request
- $rootLogger : Logger
- Default / global / root logger.
Methods
- __construct() : mixed
- Constructor
- 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.
- 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
string
$requestId
= ''
$rootLogger
Default / global / root logger.
protected
Logger
$rootLogger
Methods
__construct()
Constructor
public
__construct([string $requestId = '' ]) : mixed
Parameters
- $requestId : string = ''
-
Unique ID of the request
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
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, string $requestId) : Logger
Parameters
- $name : string
- $requestId : 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