log4j中Logger.getLogger()加载一个类提示错误
private static Logger logger = Logger.getLogger(ModelFactory.class);
错误提示如下:
The method getLogger(String) in the type Logger is not applicable for the arguments (Class<ModelFactory>)
log4j.properties的配置如下:
log4j.rootLogger=debug, R
log4j.appender.R.File=d:/log.log
log4j.appender.R=org.apache.log4j.FileAppender
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %p %t %c - %m%n
[解决办法]
你import的不会是java.util.logging.Logger吧?
要import org.apache.log4j.Logger.Logger