---
title: "Feature: #82441 - Inject logger when creating objects"
manual: "TYPO3 Core Changelog"
version: "main"
permalink: "https://docs.typo3.org/permalink/changelog:feature-82441"
source: "Changelog/9.0/Feature-82441-InjectLoggerWhenCreatingObjects.rst"
typo3-version: "9.0"
typo3-major: 9
type: "feature"
issue: 82441
forge: "https://forge.typo3.org/issues/82441"
tags: ["PHP-API"]
rendered: "2026-09-24T15:27:11+00:00"
---

# Feature: #82441 - Inject logger when creating objects {#feature-82441}

See [forge#82441](https://forge.typo3.org/issues/82441)

## Description {#description}

Classes that implement `\Psr\Log\LoggerAwareInterface` automatically
get a logger instance injected when a class instance is created via
`GeneralUtility::makeInstance()` and `ObjectManger::get()`.

For developer convenience the `\Psr\Log\LoggerAwareTrait` can be used.
The trait adds a public `setLogger()` and a protected `$logger` property
to the class, no further code is needed to successfully implement the interface.

A minimal example looks like this (example from a test case fixture):

```php
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures;

use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;

class GeneralUtilityMakeInstanceInjectLoggerFixture implements LoggerAwareInterface
{
    use LoggerAwareTrait;
}
```
