try so
<?php declare(strict_types=1);
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\App;
return function (App $app) {
$app->get('/', function (Request $request, Response $response) use ($app) {
// Here I want to log something to app.log
$logger = $app->getContainer()->get('LoggerInterface::class');
$logger->info('message');
$response->getBody()->write('Hello world!');
return $response;
});
};