xuxueli/xxl-job · error · RuntimeException

XxlJobFileAppender makeLogFileName error, logFilePath:{}

Error message

XxlJobFileAppender makeLogFileName error, logFilePath:{}

What it means

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.

Source

Thrown at xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobFileAppender.java:88

	}
	public static String getCallbackLogPath() {
		return callbackLogPath;
	}

	/**
	 * log filename, like "logPath/yyyy-MM-dd/9999.log"
	 *
	 * @param logId log id
	 * @return      log file name
	 */
	public static String makeLogFileName(Date triggerDate, long logId) {

		// "filePath/yyyy-MM-dd"
		File logFilePath = new File(getLogPath(), DateTool.formatDate(triggerDate));
        try {
            FileTool.createDirectories(logFilePath);
        } catch (IOException e) {
            throw new RuntimeException("XxlJobFileAppender makeLogFileName error, logFilePath:"+ logFilePath.getPath(), e);
        }

        // filePath/yyyy-MM-dd/9999.log
        return logFilePath.getPath()
                .concat(File.separator)
                .concat(String.valueOf(logId))
                .concat(".log");
	}

	/**
	 * append log
	 *
	 * @param logFileName	log file name
	 * @param appendLog		append log
	 */
	public static void appendLog(String logFileName, String appendLog) {

		// valid

View on GitHub (pinned to e74c784f68)

Solutions

  1. Ensure logPath exists and is writable by the executor process (chmod/chown).
  2. Mount the log directory read-write in containers, not read-only.
  3. Check free disk space and filesystem permissions on the host.
  4. Confirm initLogPath ran successfully so logBasePath is set before makeLogFileName is called.

Example fix

// before: /readonly-logs is a read-only mount
xxlJobExecutor.setLogPath("/readonly-logs/xxl-job");
// after
xxlJobExecutor.setLogPath("/data/applogs/xxl-job/jobhandler"); // writable mount
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the dated log dir is creatable/writable before scheduling
File base = new File(logPath);
if (!base.exists() && !base.mkdirs()) {
    throw new IOException("cannot create log path: " + base);
}
if (!base.canWrite()) {
    throw new IOException("log path not writable: " + base);
}

Try / catch

try {
    String name = XxlJobFileAppender.makeLogFileName(triggerDate, logId);
} catch (RuntimeException e) {
    log.error("cannot create log dir: {}", e.getMessage());
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of xuxueli/xxl-job@e74c784f68 (2026-08-14). Data as JSON: /api/errors/3502f4f7d9fcf63e. Report an issue: GitHub.