{"record":{"id":"3502f4f7d9fcf63e","repo":"xuxueli/xxl-job","slug":"xxljobfileappender-makelogfilename-error-logfilep","errorCode":null,"errorMessage":"XxlJobFileAppender makeLogFileName error, logFilePath:{}","messagePattern":"XxlJobFileAppender makeLogFileName error, logFilePath:(.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobFileAppender.java","lineNumber":88,"sourceCode":"\t}\n\tpublic static String getCallbackLogPath() {\n\t\treturn callbackLogPath;\n\t}\n\n\t/**\n\t * log filename, like \"logPath/yyyy-MM-dd/9999.log\"\n\t *\n\t * @param logId log id\n\t * @return      log file name\n\t */\n\tpublic static String makeLogFileName(Date triggerDate, long logId) {\n\n\t\t// \"filePath/yyyy-MM-dd\"\n\t\tFile logFilePath = new File(getLogPath(), DateTool.formatDate(triggerDate));\n        try {\n            FileTool.createDirectories(logFilePath);\n        } catch (IOException e) {\n            throw new RuntimeException(\"XxlJobFileAppender makeLogFileName error, logFilePath:\"+ logFilePath.getPath(), e);\n        }\n\n        // filePath/yyyy-MM-dd/9999.log\n        return logFilePath.getPath()\n                .concat(File.separator)\n                .concat(String.valueOf(logId))\n                .concat(\".log\");\n\t}\n\n\t/**\n\t * append log\n\t *\n\t * @param logFileName\tlog file name\n\t * @param appendLog\t\tappend log\n\t */\n\tpublic static void appendLog(String logFileName, String appendLog) {\n\n\t\t// valid","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/xuxueli/xxl-job/blob/e74c784f68f81fa89cb350913ef15794865d7b12/xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobFileAppender.java#L70-L106","documentation":"Thrown by XxlJobFileAppender.makeLogFileName as a RuntimeException wrapping an IOException when the per-date log directory (logBasePath/<yyyy-MM-dd>) cannot be created. FileTool.createDirectories failed, so the dated log folder is unusable.","triggerScenarios":"makeLogFileName(triggerDate, logId) where the parent logBasePath is not writable, does not exist and cannot be created, is a file not a directory, or the process lacks permission; also if triggerDate yields an unformattable path segment.","commonSituations":"logPath points to a read-only mount or a path owned by another user; disk full; SELinux/AppArmor denies writes; container mounted the log dir read-only; logBasePath was never initialised (null) producing an invalid File.","solutions":["Ensure logPath exists and is writable by the executor process (chmod/chown).","Mount the log directory read-write in containers, not read-only.","Check free disk space and filesystem permissions on the host.","Confirm initLogPath ran successfully so logBasePath is set before makeLogFileName is called."],"exampleFix":"// before: /readonly-logs is a read-only mount\nxxlJobExecutor.setLogPath(\"/readonly-logs/xxl-job\");\n// after\nxxlJobExecutor.setLogPath(\"/data/applogs/xxl-job/jobhandler\"); // writable mount","handlingStrategy":"validation","validationCode":"// Ensure the dated log dir is creatable/writable before scheduling\nFile base = new File(logPath);\nif (!base.exists() && !base.mkdirs()) {\n    throw new IOException(\"cannot create log path: \" + base);\n}\nif (!base.canWrite()) {\n    throw new IOException(\"log path not writable: \" + base);\n}","typeGuard":null,"tryCatchPattern":"try {\n    String name = XxlJobFileAppender.makeLogFileName(triggerDate, logId);\n} catch (RuntimeException e) {\n    log.error(\"cannot create log dir: {}\", e.getMessage());\n}","preventionTips":["Provision a writable, writable-checked log directory at deploy time.","Mount the log dir read-write in containers.","Run initLogPath before any job triggers so logBasePath is valid."],"tags":["logging","filesystem","permissions","io","runtime"],"backgroundTag":null,"analyzedSha":"e74c784f68f81fa89cb350913ef15794865d7b12","analyzedAt":"2026-08-14T04:22:43.715Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}