Log4j and SLF4J getting StackOverflowError on startup

This issue is only possible when you have two SLF4J jars together those are
– log4j-slf4j-impl-2.4.1.jar
– g4j-to-slf4j-2.4.1.jar

Following is the few lines of the error

StackOverflowError
at org.apache.logging.log4j.util.ReflectionUtil.getCallerClass

Solution

Remove g4j-to-slf4j-2.4.1.jar from your library and it will work just fine