Log4j:error a "Org.apache.log4j.DailyRollingFileAppender" object is not assignable to a "org.apache.log4j.Appender" Variable.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.