[Solved] XxlJob Error: XxlJobFileAppender [101] -| Permission denied

1. Xxljob reports an error. Xxljobfileappender [101] – [permission denied

An error is reported in xxljob: xxljobfileappender [101] – [permission denied. The detailed error is as follows:

2021-09-15 09:28:45.686 |-ERROR [Thread-1565] com.xxl.job.core.log.XxlJobFileAppender [101] -| Permission denied
java.io.IOException: Permission denied
        at java.io.UnixFileSystem.createFileExclusively(Native Method)
        at java.io.File.createNewFile(File.java:1012)
        at com.xxl.job.core.log.XxlJobFileAppender.appendLog(XxlJobFileAppender.java:99)
        at com.xxl.job.core.context.XxlJobHelper.logDetail(XxlJobHelper.java:164)
        at com.xxl.job.core.context.XxlJobHelper.log(XxlJobHelper.java:118)
        at com.cuai.cbam.monitor.task.SystemOperateTask.checkSystemTask(SystemOperateTask.java:41)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.xxl.job.core.handler.impl.MethodJobHandler.execute(MethodJobHandler.java:31)
        at com.xxl.job.core.thread.JobThread.run(JobThread.java:163)

2. Positioning problem

After analyzing the log, you can find that it is normal to use logback to output the log, but use * * xxljobhelper.log (“…”)** When an error is reported, check the relevant configuration of xxljob and find a logpath parameter. Combined with the error, it is speculated that the server does not have the configured logpath path or the current operating user does not have the operation permission of the logpath path

3. Problem solving

Grant the logpath path the permission that the current user can operate, and then restart the application. It is found that the program is normal. So far, the problem has been solved.

Read More: