Multiple ClassLoader load log4j need to set the current thread ClassLoader for your own ClassLoader
// For log4j
Excerpt from: Org.apache.log4j.helpers.Loader
/*** If running under JDK 1.2 load the specified class using the * <code>Thread</code> <code>cont extclassloader</code> if that * fails try class.forname. Under JDK 1.1 only Class.forName is * used. * */ Static PublicClass loadclass (String clazz)throwsClassNotFoundException {//Just call Class.forName (clazz) If we are running under JDK 1.1//or if we are instructed to ignore the TCL. if(JAVA1 | |IGNORETCL) { returnClass.forName (Clazz); } Else { Try { returngettcl (). LoadClass (Clazz); } Catch(Throwable e) {//we reached here because TCL is null or because of a//security exception, or because Clazz could not be loaded ...//In any case we now try one more time returnClass.forName (Clazz); } }
log4j:error A "Org.apache.log4j.DailyRollingFileAppender" object is not assignable to a "org.apache.log4j.Appender "Variable.log4j:ERROR the Class" Org.apache.log4j.Appender "was loaded bylog4j:error [[email protected]40] Whereas object of Typelog4j:error "Org.apache.log4j.DailyRollingFileAppender" is loaded by [[email protected]]. Log4j:error Could not instantiate appender named "Main". Log4j:error A "Org.apache.log4j.ConsoleAppender" object was not an Ignable to a "Org.apache.log4j.Appender" Variable.log4j:ERROR the Class "Org.apache.log4j.Appender" was loaded bylog4j: ERROR [[email protected]40] whereas object of Typelog4j:error "Org.apache.log4j.ConsoleAppender" was loaded by [[ Email protected]].log4j:error Could not instantiate appender named "Console". Log4j:warn No appenders Could being found F or logger (com.generallycloud.baseio.component.ssl.SSLUtil). Log4j:warn Please initialize the log4j system properly.
Original: http://www.cnblogs.com/gifisan/p/6879465.html
Log4j:error a "Org.apache.log4j.DailyRollingFileAppender" object is not assignable to a "org.apache.log4j.Appender" Variable.