Seems like magento/product-community-edition:2.4.8 has following dependency "monolog/monolog": "^3.6" which in turn doesn't have getLevels() anymore so according to https://github.com/Seldaek/monolog/blob/main/CHANGELOG.md#300-rc1-2022-05-08 some changes are required.