Use gradle logger with log4j2

Hello, this is related with my previous question.

in build.gradle, we have logger variable from “org.gradle.api.logging.Logger”, and we use it to print logs during gradle build.

However, anyone know how to create my own logger in build.gradle from log4j2 instead this default one, or override default one with log4j2, so I can apply log4j2 configurations?

As said in your other question. Gradle is not using log4j as logging framework, so you cannot use log4j configuration. If you want to use an own logger, you can create an slf4j logger which also is the superclass of the Gradle logger, then you just miss the lifecycle level. But actually it does not make too much sense, as you cannot configure the logging per level.