diff --git a/core/java/src/net/i2p/util/LogWriter.java b/core/java/src/net/i2p/util/LogWriter.java index 0b476ff2782a19e3e29ea3cb78aac6c25a640526..a4c8b346660cafb29e5e6e40d070f7102f1ef180 100644 --- a/core/java/src/net/i2p/util/LogWriter.java +++ b/core/java/src/net/i2p/util/LogWriter.java @@ -46,10 +46,16 @@ class LogWriter implements Runnable { public void run() { _write = true; - rotateFile(); - while (_write) { - flushRecords(); - rereadConfig(); + try { + rotateFile(); + while (_write) { + flushRecords(); + rereadConfig(); + } + System.err.println("Done writing"); + } catch (Exception e) { + System.err.println("Error writing the logs: " + e.getMessage()); + e.printStackTrace(); } } @@ -131,17 +137,19 @@ class LogWriter implements Runnable { _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()); + if (parent != null) { + 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); } } - 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) {