diff --git a/core/java/src/net/i2p/util/LogWriter.java b/core/java/src/net/i2p/util/LogWriter.java index c8b26dc299fae63c8324cd2ad046e7b90db490d3..54a2c9eef9a76690250a1c9b0935dda6e302c8cb 100644 --- a/core/java/src/net/i2p/util/LogWriter.java +++ b/core/java/src/net/i2p/util/LogWriter.java @@ -122,6 +122,18 @@ class LogWriter implements Runnable { File f = getNextFile(pattern); _currentFile = f; _numBytesInCurrentFile = 0; + File parent = f.getParentFile(); + if (!parent.exists()) { + boolean ok = parent.mkdirs(); + if (!ok) { + System.err.println("Unable to create the parent directy: " + parent.getAbsolutePath()); + System.exit(0); + } + } + if (!parent.isDirectory()) { + System.err.println("wtf, we cannot put the logs in a subdirectory of a plain file! we want to stre the log as " + f.getAbsolutePath()); + System.exit(0); + } try { _currentOut = new FileOutputStream(f); } catch (IOException ioe) {