Exclude log4j to use slf4j with logback in a Gradle project

The goal is to remove log4j from all transitive dependencies in a Gradle project and replace it by slf4j and logback.