HADOOP-10288. Explicit reference to Log4JLogger breaks non-log4j users. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1561882 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e21a03f717
commit
6016d7d4da
@ -542,6 +542,9 @@ Release 2.4.0 - UNRELEASED
|
|||||||
HADOOP-10250. VersionUtil returns wrong value when comparing two versions.
|
HADOOP-10250. VersionUtil returns wrong value when comparing two versions.
|
||||||
(Yongjun Zhang via atm)
|
(Yongjun Zhang via atm)
|
||||||
|
|
||||||
|
HADOOP-10288. Explicit reference to Log4JLogger breaks non-log4j users
|
||||||
|
(todd)
|
||||||
|
|
||||||
Release 2.3.0 - UNRELEASED
|
Release 2.3.0 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -53,7 +53,17 @@ public static RequestLog getRequestLog(String name) {
|
|||||||
String appenderName = name + "requestlog";
|
String appenderName = name + "requestlog";
|
||||||
Log logger = LogFactory.getLog(loggerName);
|
Log logger = LogFactory.getLog(loggerName);
|
||||||
|
|
||||||
if (logger instanceof Log4JLogger) {
|
boolean isLog4JLogger;;
|
||||||
|
try {
|
||||||
|
isLog4JLogger = logger instanceof Log4JLogger;
|
||||||
|
} catch (NoClassDefFoundError err) {
|
||||||
|
// In some dependent projects, log4j may not even be on the classpath at
|
||||||
|
// runtime, in which case the above instanceof check will throw
|
||||||
|
// NoClassDefFoundError.
|
||||||
|
LOG.debug("Could not load Log4JLogger class", err);
|
||||||
|
isLog4JLogger = false;
|
||||||
|
}
|
||||||
|
if (isLog4JLogger) {
|
||||||
Log4JLogger httpLog4JLog = (Log4JLogger)logger;
|
Log4JLogger httpLog4JLog = (Log4JLogger)logger;
|
||||||
Logger httpLogger = httpLog4JLog.getLogger();
|
Logger httpLogger = httpLog4JLog.getLogger();
|
||||||
Appender appender = null;
|
Appender appender = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user