gwt-log
gwt-log copied to clipboard
gwt-log-3.3.2 does not support log4j-2.1
What version of GWT are you using? 1.4.60? 2.0.4? Other?
GWT - 2.6.0
What version of the gwt-log jar file or library file are you using?
3.3.2
What operating system(s) are you using? Windows? Linux? Mac?
Windows
Does the issue occur in web mode, development mode (formerly "hosted
mode"), both or don't know?
both
Do you have a workaround?
The class "com.allen_sauer.gwt.log.server.ServerLogImplLog4J" uses log4j
classes (like Logger, Level and MDC) from package "org.apache.log4j". In
log4j-2.1 the package naming changed to "org.apache.logging.log4j", the
"org.apache.log4j.MDC"-class has been replaced (or better merged with the
"NDC"-class same package) by "org.apache.logging.log4j.ThreadContext"-class,
the Method "toInt()" of class "org.apache.log4j.Level" renamed to "intLevel()"
and the Method "setLevel" of "org.apache.log4j.Logger" does no longer exist.
Replacing usage by
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
Configuration conf = ctx.getConfiguration();
conf.getLoggerConfig(logger.getName()).setLevel(getLevel(level));
ctx.updateLoggers(conf);
with
private Level getLevel(int level) {
for (Level currLevel : Level.values()) {
if (currLevel.intLevel() == level) {
return currLevel;
}
}
return Level.OFF;
}
should do the same. Can you please fix that issue?
Greetings
Macke
Original issue reported on code.google.com by [email protected]
on 12 Jan 2015 at 10:00