我想基于slf4j和log4j配置我的日志系统。我想记录来自 com.A 类的所有消息。只有那些消息。
所以我在我的配置文件中写了
log4j.rootLogger=致命,全部 log4j.rootLogger=调试,A1 log4j.appender.A1=com.A log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.conversionPattern=%m%n
我的跑步者(com.Start 类)包含
PropertyConfigurator.configure("log4j.properties");
但是当我开始申请时,我得到
log4j:ERROR A "com.A" 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@d9f9c3] whereas object of type
log4j:ERROR "com.A" was loaded by [sun.misc.Launcher$AppClassLoader@d9f9c3].
log4j:ERROR Could not instantiate appender named "A1".
log4j:WARN No appenders could be found for logger (com.Start).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
我的错误在哪里?
谢谢。