控制台打印的异常信息:
log4j:ERROR Could not instantiate class [org.apache.log4j.ConsoleAppender # ?????¨].
java.lang.ClassNotFoundException: org.apache.log4j.ConsoleAppender # ?????¨
出错位置:
log4j.properties 资源文件
# An example log4j configuration file that outputs to System.out. The
# output information consists of relative time, log level, thread
# name, logger name, nested diagnostic context and the message in that
# order.
# For the general syntax of property based configuration files see the
# documenation of org.apache.log4j.PropertyConfigurator.
log4j.rootLogger=INFO,CONSOLE,FILE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender # 控制台
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout # 可以灵活地指定布局模式
log4j.appender.CONSOLE.layout.ConversionPattern=[%-5p] %t %d %37c %3x - %m%n # 设置日志输出格式
#log4j.appender.CONSOLE.Threshold=INFO
log4j.appender.FILE=org.apache.log4j.RollingFileAppender # 文件大小到达指定尺寸的时候产生一个新的文
log4j.appender.FILE.file=./LogFile.log
log4j.appender.FILE.maxFileSize=2MB
log4j.appender.FILE.maxBackupIndex=10
log4j.appender.FILE.append=true
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=[%-5p] %t %d %37c %3x - %m%n
log4j.logger.com.spoto=debug
log4j.logger.org=INFO
log4j.logger.net=INFO
log4j.logger.uk=INFO
如何解决:
将log4j.properties文件中的中文注释信息改成英文或删掉这些内容
LOG4J 使用说明 http://gocom.primeton.com/modules/newbb/item42934_42934.htm