log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable

exception, gradle, java, log4j, logging

Solution

Adding this annotation works for me.

@PowerMockIgnore("org.apache.log4j.*") 

Problem

I am making a web app using gradle. I used log4j in this app. When I build the project I am getting error... - log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable. - log4j:ERROR The class "org.apache.log4j.Appender" was loaded by - log4j:ERROR [org.powermock.core.classloader.MockClassLoader@16a40b2] whereas object of type - log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [sun.misc.Launcher$AppClassLoader@5e3a78ad]. - log4j:ERROR Could not instantiate appender named "stdout". I still did not find a good answer. And I forgot to say, My project build correctly and show log massages correctly. It doesn't work only on test classes.

Original source