xuxueli/xxl-job · critical · RuntimeException

xxl-job logPath cannot be empty

Error message

xxl-job logPath cannot be empty

What it means

Thrown by XxlJobFileAppender.initLogPath as a RuntimeException when the supplied logPath is blank. The appender needs a concrete base directory to create the log tree and glue source dir, so an empty path aborts initialization.

Source

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

	 * strut like:
	 * 	---/
	 * 	---/gluesource/10_1514171108000.js
	 * 	---/callbacklogs/xxl-job-callback-1761412677119.log
	 * 	---/2017-12-25/639.log
	 * 	---/2017-12-25/821.log
	 *
	 */
	private static String logBasePath;
	private static String glueSrcPath;
	private static String callbackLogPath;

	/**
	 * init log path
	 */
	public static void initLogPath(String logPath) throws IOException {
		// init
		if (StringTool.isBlank(logPath)) {
			throw new RuntimeException("xxl-job logPath cannot be empty");
		}
		logBasePath = logPath.trim();

		// mk base dir
		File logPathDir = new File(logBasePath);
        FileTool.createDirectories(logPathDir);
		logBasePath = logPathDir.getPath();

		// mk glue dir
		File glueBaseDir = new File(logPathDir, "gluesource");
        FileTool.createDirectories(glueBaseDir);
		glueSrcPath = glueBaseDir.getPath();

		// mk callback log dir
		File callbackBaseDir = new File(logPathDir, "callbacklogs");
        FileTool.createDirectories(callbackBaseDir);
		callbackLogPath = callbackBaseDir.getPath();
	}

View on GitHub (pinned to e74c784f68)

Solutions

  1. Set xxl.job.executor.logpath (or setLogPath) to a writable absolute path, e.g. "/data/applogs/xxl-job/jobhandler".
  2. Confirm the directory is writable by the executor process.
  3. Inject the path via env var in containerized deployments.

Example fix

// before
xxlJobExecutor.setLogPath("");
// after
xxlJobExecutor.setLogPath("/data/applogs/xxl-job/jobhandler");
Defensive patterns

Strategy: validation

Validate before calling

String logPath = config.getLogPath();
if (StringTool.isBlank(logPath)) {
    throw new IllegalStateException("xxl.job.executor.logpath is required");
}

Try / catch

try {
    XxlJobFileAppender.initLogPath(logPath);
} catch (RuntimeException e) {
    log.error("log path init failed: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling initLogPath("") or initLogPath(null) (blank per StringTool.isBlank), typically via XxlJobExecutor.start() passing its logPath field which was unset (xxl.job.executor.logpath missing).

Common situations: xxl.job.executor.logpath omitted from configuration; env var for the log path not injected in a container; custom executor setup that skips setting logPath.

Related errors


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