log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: \_debug.log (拒绝访问。) at java.io.FileOutputStream.open0(Native Method) at java.io.FileOutputStream.open(FileOutputStream.java:270) at java.io.FileOutputStream.<init>(FileOutputStream.java:213) at java.io.FileOutputStream.<init>(FileOutputStream.java:133) at org.apache.log4j.FileAppender.setFile(FileAppender.java:294) at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165) at org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRollingFileAppender.java:223) at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:172) at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:104) at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:842) at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768) at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:580) at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526) at org.apache.log4j.LogManager.<clinit>(LogManager.java:127) at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:63) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281) at org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:39) at org.apache.commons.logging.LogFactory$Log4jLog.<init>(LogFactory.java:204) at org.apache.commons.logging.LogFactory$Log4jDelegate.createLog(LogFactory.java:166) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:109) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:99) at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:201) at com.debug.mooc.dubbo.one.server.BootMoreApplication.main(BootMoreApplication.java:30) log4j:ERROR Either File or DatePattern options are not set for appender [debug]. log4j:ERROR setFile(null,true) call failed.java.io.FileNotFoundException: \_info.log (拒绝访问。)
#logging logging.path=E:\\logs\\log logging.file=dubboOne logging.level.org.springframework = INFO logging.level.com.fasterxml.jackson = INFO logging.level.com.debug.mooc.dubbo.one = debug
改路径之前也是这个错,改完了自己把目录都建好了,还是这个错,不太懂log4j,网上说是tomcat啥访问目录权限问题,请教下
你把根目录磁盘的权限 改为允许写读 试试
我只改了路径,没去创建相应的log文件夹,直接运行过了
细心读取错误信息会发现无法创建和无法设置日志文件。
查看是否配置了log4j.properties文件,如果正确配置了进行下一步。
查看配置文件项目中单项是否配置正确例如(4),
log4j.appender.error.File=${LOG_PATH}/${LOG_FILE}_error.log
注意要为LOG_PATH和LOG_FILE配置值例如(6)
LOG_PATH=/Users/yu/IdeaProjects/dubboOne/logs LOG_FILE=log
info,error,warn都需要修改。
我也遇到这个错误了,我自己新建立的logs目录权限都改成775了 还是报这个错 ,我是在mac上做的