ERROR in ch.qos.logback.core.rolling.RollingFileAppender - Failed to create parent directories for
problem
After importing idea into the project, start the project and report an error
11:35:50,371 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[file] - Active log file name: /data/applogs/xxx/xxx-server.log
11:35:50,371 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[file] - File property is set to [/data/applogs/xxx/xxx-server.log]
11:35:50,372 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[file] - Failed to create parent directories for [/data/applogs/xxx/xxx-server.log]
11:35:50,373 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[file] - openFile(/data/applogs/xxx/xxx-server.log,true) call failed. java.io.FileNotFoundException: /data/applogs/xxx/xxx-server.log (No such file or directory)
at java.io.FileNotFoundException: /data/applogs/xxx/xxx-server.log (No such file or directory)
at at java.io.FileOutputStream.open0(Native Method)
at at java.io.FileOutputStream.open(FileOutputStream.java:270)
reason
Looking at the log means: creating a log file and reporting an error
Checking the directory, there is no such file or directory in the system
solution
Create directories and files manually
- /data/applogs cannot participate and an error is reported, so it is changed to another directory /opt/applogs
- Create directories and files with sudo permissions
sudo mkdir -p /opt/applogs/xxx/
sudo touch /opt/applogs/xxx-server.log
- Setting permissions
sudo chmod 777 xxx-server.log
- /data/applogs global search replaced with /opt/applogs
About the opt directory
- In the Mac OS X operating system, the opt folder generally refers to the /opt directory.
- This directory is specifically used to install and store third-party software and applications.
- It is stored separately from the software and applications that come with the system to avoid interference with the system.