异常分为两种:Exception、Error
Exception:异常,可以捕捉到,进行处理以后可以让程序继续正常执行
Error:错误,不能捕捉,只能修改代码,重新执行
Throwable->Exception->(RuntimeException->非运行时异常)
throw:抛出指定的异常
throws:用在方法声明处,声明该方法可能发生的异常类型
Log4j
配置文件
log4j.rootLogger=DEBUG,C,FD,FE
#Console--output
log4j.appender.C=org.apache.log4j.ConsoleAppender
log4j.appender.C.layout=org.apache.log4j.PatternLayout
log4j.appender.C.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
#File--output---level=debug
log4j.appender.FD=org.apache.log4j.DailyRollingFileAppender
log4j.appender.FD.File=D://Temporary/logs/debug.log
log4j.appender.FD.Append=true
log4j.appender.FD.Threshold=DEBUG
log4j.appender.FD.layout=org.apache.log4j.PatternLayout
log4j.appender.FD.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
#File--output---level=error
log4j.appender.FE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.FE.File=D://Temporary/logs/error.log
log4j.appender.FE.Append=true
log4j.appender.FE.Threshold=ERROR
log4j.appender.FE.layout=org.apache.log4j.PatternLayout
log4j.appender.FE.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
#log4j.logger.org.apache.ibatis = INFO