ContextInitializer in logback-classic version 1.2.9 does not support Groovy config file

There's no workaround. Groovy support was removed in 1.2.9 for security reasons. From the release announcement:

Removed Groovy configuration support. As logging is so pervasive and configuration with Groovy is probably too powerful, this feature is unlikely to be reinstated for security reasons.

This removal, along with some other changes, was done in response to CVE-2021-42550.