application.yml 与老师提供的相同(ip地址相应调整,能ping通) logback-spring.xml 与老师提供的相同

来源:3-2 日志的使用

cjozGV

2019-05-15

2019-05-15 21:04:09,889 - Application startup failed
Exception in thread “main” java.lang.IllegalStateException: Logback configuration error detected:
java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[fileInfoLog] - openFile(null,true) call failed. java.io.FileNotFoundException: D:\var\log\tomcat\sell\info.2019-05-15.log (拒绝访问。)
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[fileErrorLog] - openFile(null,true) call failed. java.io.FileNotFoundException: D:\var\log\tomcat\sell\error.2019-05-15.log (拒绝访问。)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:162)
at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:81)
at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:59)
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[fileInfoLog] - openFile(null,true) call failed. java.io.FileNotFoundException: D:\var\log\tomcat\sell\info.2019-05-15.log (拒绝访问。)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:115)
at org.springframework.boot.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:303)
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[fileErrorLog] - openFile(null,true) call failed. java.io.FileNotFoundException: D:\var\log\tomcat\sell\error.2019-05-15.log (拒绝访问。)
at org.springframework.boot.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:276)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:162)
at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:239)
at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:81)
at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:212)
at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:59)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:115)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
at org.springframework.boot.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:303)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:73)
at org.springframework.boot.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:276)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:336)
at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:239)
at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:212)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
at com.imooc.SellApplication.main(SellApplication.java:10)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:73)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:336)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
at com.imooc.SellApplication.main(SellApplication.java:10)

Process finished with exit code 1

写回答

1回答

廖师兄

2019-05-15

D:\var\log\tomcat\sell\info.2019-05-15.log (拒绝访问。)

关于日志的路径

要先去建好这个目录 /var/log/tomcat/sell,否则会报错

Linux/Mac 下,还要给予可写权限

sudo chmod -R 777 /var/log/tomcat/sell


Windows下,路径格式类似

D:\var\log\tomcat\sell


0
6
廖师兄
回复
cjozGV
windows还有专门设置权限?你可以截图发出来说一下,给后面学习的同学指导一下。
2019-05-17
共6条回复

Spring Boot双版本(1.5/2.1) 打造企业级微信点餐系统

从0到1开发中小型企业级Java应用,并学会迭代重构技巧

6410 学习 · 5247 问题

查看课程