1.引入log4j-xxx.jar包,buildpath. 2.在项目的根目录下新建resources名的文件夹,注意是source folder,并新建log4j.properties文件 3.在log4j.properties中配置: #LOG_DIR:/usr/local/.../logs LOG_DIR = E:\\logs #Level:ERROR,WARN,INFO,DEBUG log4j.rootLogger = DEBUG,Console,FileInfo,FileError l