‪TYPO3CMS  11.5
TYPO3\CMS\Core\Log\LogManager Class Reference
Inheritance diagram for TYPO3\CMS\Core\Log\LogManager:
TYPO3\CMS\Core\SingletonInterface TYPO3\CMS\Core\Log\LogManagerInterface

Public Member Functions

 __construct (string $requestId='')
 
 reset ()
 
Logger getLogger (string $name='')
 
 registerLogger ($name)
 
array getLoggerNames ()
 

Public Attributes

const CONFIGURATION_TYPE_WRITER = 'writer'
 
const CONFIGURATION_TYPE_PROCESSOR = 'processor'
 

Protected Member Functions

 makeLogger (string $name, string $requestId)
 
 setWritersForLogger (Logger $logger)
 
 setProcessorsForLogger (Logger $logger)
 
array getConfigurationForLogger ($configurationType, $loggerName)
 

Protected Attributes

array $loggers = []
 
Logger $rootLogger
 
string $requestId = ''
 

Detailed Description

Global LogManager that keeps track of global logging information.

Inspired by java.util.logging

Definition at line 32 of file LogManager.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Log\LogManager::__construct ( string  $requestId = '')

Constructor

Parameters
string$requestId‪Unique ID of the request

Definition at line 64 of file LogManager.php.

References TYPO3\CMS\Core\Log\LogManager\$requestId, and TYPO3\CMS\Core\Log\LogManager\$rootLogger.

Member Function Documentation

◆ getConfigurationForLogger()

array TYPO3\CMS\Core\Log\LogManager::getConfigurationForLogger (   $configurationType,
  $loggerName 
)
protected

Returns the configuration from $TYPO3_CONF_VARS['LOG'] as hierarchical array for different components of the class hierarchy.

Parameters
string$configurationTypeType of config to return (writer, processor)
string$loggerNameLogger name
Exceptions

Definition at line 192 of file LogManager.php.

References $GLOBALS, TYPO3\CMS\Core\Log\LogLevel\normalizeLevel(), and TYPO3\CMS\Core\Log\LogLevel\validateLevel().

Referenced by TYPO3\CMS\Core\Log\LogManager\setProcessorsForLogger(), and TYPO3\CMS\Core\Log\LogManager\setWritersForLogger().

◆ getLogger()

Logger TYPO3\CMS\Core\Log\LogManager::getLogger ( string  $name = '')

Gets a logger instance for the given name.

\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
string$nameLogger name, empty to get the global "root" logger.
Returns
Logger Logger with name $name

Implements TYPO3\CMS\Core\Log\LogManagerInterface.

Definition at line 91 of file LogManager.php.

References TYPO3\CMS\Core\Log\LogManager\makeLogger().

◆ getLoggerNames()

array TYPO3\CMS\Core\Log\LogManager::getLoggerNames ( )

For use in unit test context only.

Returns
‪array

Definition at line 126 of file LogManager.php.

◆ makeLogger()

TYPO3\CMS\Core\Log\LogManager::makeLogger ( string  $name,
string  $requestId 
)
protected

Instantiates a new logger object, with the appropriate attached writers and processors.

Definition at line 103 of file LogManager.php.

References TYPO3\CMS\Core\Log\LogManager\$requestId, TYPO3\CMS\Core\Log\LogManager\setProcessorsForLogger(), and TYPO3\CMS\Core\Log\LogManager\setWritersForLogger().

Referenced by TYPO3\CMS\Core\Log\LogManager\getLogger().

◆ registerLogger()

TYPO3\CMS\Core\Log\LogManager::registerLogger (   $name)

For use in unit test context only.

Parameters
string$name

Definition at line 116 of file LogManager.php.

◆ reset()

TYPO3\CMS\Core\Log\LogManager::reset ( )

For use in unit test context only. Resets the internal logger registry.

Definition at line 74 of file LogManager.php.

◆ setProcessorsForLogger()

TYPO3\CMS\Core\Log\LogManager::setProcessorsForLogger ( Logger  $logger)
protected

Appends the processors to the given logger as configured.

Parameters
\TYPO3\CMS\Core\Log\Logger$loggerLogger to configure

Definition at line 163 of file LogManager.php.

References TYPO3\CMS\Core\Log\Logger\addProcessor(), TYPO3\CMS\Core\Log\LogManager\getConfigurationForLogger(), and TYPO3\CMS\Core\Log\Logger\getName().

Referenced by TYPO3\CMS\Core\Log\LogManager\makeLogger().

◆ setWritersForLogger()

TYPO3\CMS\Core\Log\LogManager::setWritersForLogger ( Logger  $logger)
protected

Appends the writers to the given logger as configured.

Parameters
\TYPO3\CMS\Core\Log\Logger$loggerLogger to configure

Definition at line 136 of file LogManager.php.

References TYPO3\CMS\Core\Log\Logger\addWriter(), TYPO3\CMS\Core\Log\LogManager\getConfigurationForLogger(), and TYPO3\CMS\Core\Log\Logger\getName().

Referenced by TYPO3\CMS\Core\Log\LogManager\makeLogger().

Member Data Documentation

◆ $loggers

array TYPO3\CMS\Core\Log\LogManager::$loggers = []
protected

Loggers to retrieve them for repeated use.

Definition at line 47 of file LogManager.php.

◆ $requestId

string TYPO3\CMS\Core\Log\LogManager::$requestId = ''
protected

Unique ID of the request

Definition at line 57 of file LogManager.php.

Referenced by TYPO3\CMS\Core\Log\LogManager\__construct(), and TYPO3\CMS\Core\Log\LogManager\makeLogger().

◆ $rootLogger

Logger TYPO3\CMS\Core\Log\LogManager::$rootLogger
protected

Default / global / root logger.

Definition at line 52 of file LogManager.php.

Referenced by TYPO3\CMS\Core\Log\LogManager\__construct().

◆ CONFIGURATION_TYPE_PROCESSOR

const TYPO3\CMS\Core\Log\LogManager::CONFIGURATION_TYPE_PROCESSOR = 'processor'

Definition at line 42 of file LogManager.php.

◆ CONFIGURATION_TYPE_WRITER

const TYPO3\CMS\Core\Log\LogManager::CONFIGURATION_TYPE_WRITER = 'writer'

Definition at line 37 of file LogManager.php.