Log4j: ERROR
I got a gwt project and I use gwt run configuration to run the application. Recently I upgraded gwt library from version 2.5.0 to 2.7.0. After the gwt library upgrade, I lost console logging with the following message. I have log4j.jar in my web app but no idea how/where sun.misc.Launcher$AppClassLoader is loading "org.apache.log4j.Appender" class (from). Any would be appreciated.
============ Error while running running app from gwt run configuration ============
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 [sun.misc.Launcher$AppClassLoader@4d885088] whereas object of type
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [WebAppClassLoader=Lynx Reservations (Jag Client) - ${bamboo.build}@6fcaf06b].
log4j:ERROR Could not instantiate appender named "stdout".
===============Contents of log4j.properties file ==================
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} [%t] %-5p [%F:%L] : %m%n
### set standard log levels ###
log4j.rootLogger=WARN, stdout
log4j.logger.com.lynxtraveltech=debug
Please sign in to leave a comment.
Do you use any build system (Maven , Gradle)? Please check that your classpath doesn't contain 2 copies of log4j library.
Yes I use Maven build system.
I checked all three following places in IntelliJ but I got only one copy of log4j.jar (log4j-1.2.13.jar)
I have noticed a log4j.jar in IntelliJ home lib directory
Please check the command line when the app is started, do you see multiple log4j jars added there? Compare it to the classpath of your app before GWT update.
I checked both command lines and no multiple log4j.jar is found. But I noticed that IntelliJ generated different command lines with different parameters at starts and ends. I am running IntelliJ version 2017.3. with maven 3.04 and jdk 1.7.0_75
Hello,
I noticed that for gwt 2.5 you have debug Run Configuration while for gwt 2.7 you have regular one.
In second case there's IDEA runtime agent configured with this line: "-javaagent:$IDEA_HOME\lib\idea_rt.jar=49423:$IDEA_HOME\bin". It might load its own log4j, so please try using debug mode, it should help.