Use logging system in code run "inside" Getdown.

Command line tools may still use stdout/stderr directly.
This commit is contained in:
Michael Bayne
2018-09-14 15:00:55 -07:00
parent 935f77e3e8
commit 2bd10cf8a1
2 changed files with 10 additions and 10 deletions
@@ -1088,7 +1088,7 @@ public class Application
log.info("Invoking main({" + StringUtil.join(args, ", ") + "})"); log.info("Invoking main({" + StringUtil.join(args, ", ") + "})");
main.invoke(null, new Object[] { args }); main.invoke(null, new Object[] { args });
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(System.err); log.warning("Failure invoking app main", e);
} }
} }
@@ -65,24 +65,24 @@ public class Patcher
// depending on the suffix, we do The Right Thing (tm) // depending on the suffix, we do The Right Thing (tm)
if (path.endsWith(CREATE)) { if (path.endsWith(CREATE)) {
path = strip(path, CREATE); path = strip(path, CREATE);
System.out.println("Creating " + path + "..."); log.info("Creating " + path + "...");
createFile(file, entry, new File(appdir, path)); createFile(file, entry, new File(appdir, path));
} else if (path.endsWith(PATCH)) { } else if (path.endsWith(PATCH)) {
path = strip(path, PATCH); path = strip(path, PATCH);
System.out.println("Patching " + path + "..."); log.info("Patching " + path + "...");
patchFile(file, entry, appdir, path); patchFile(file, entry, appdir, path);
} else if (path.endsWith(DELETE)) { } else if (path.endsWith(DELETE)) {
path = strip(path, DELETE); path = strip(path, DELETE);
System.out.println("Removing " + path + "..."); log.info("Removing " + path + "...");
File target = new File(appdir, path); File target = new File(appdir, path);
if (!FileUtil.deleteHarder(target)) { if (!FileUtil.deleteHarder(target)) {
System.err.println("Failure deleting '" + target + "'."); log.warning("Failure deleting '" + target + "'.");
} }
} else { } else {
System.err.println("Skipping bogus patch file entry: " + path); log.warning("Skipping bogus patch file entry: " + path);
} }
// note that we've completed this entry // note that we've completed this entry
@@ -120,7 +120,7 @@ public class Patcher
} }
} catch (IOException ioe) { } catch (IOException ioe) {
System.err.println("Error creating '" + target + "': " + ioe); log.warning("Error creating '" + target + "': " + ioe);
} }
} }
@@ -144,7 +144,7 @@ public class Patcher
// move the current version of the jar to .old // move the current version of the jar to .old
if (!FileUtil.renameTo(target, otarget)) { if (!FileUtil.renameTo(target, otarget)) {
System.err.println("Failed to .oldify '" + target + "'."); log.warning("Failed to .oldify '" + target + "'.");
return; return;
} }
@@ -162,9 +162,9 @@ public class Patcher
} catch (IOException ioe) { } catch (IOException ioe) {
if (patcher == null) { if (patcher == null) {
System.err.println("Failed to write patch file '" + patch + "': " + ioe); log.warning("Failed to write patch file '" + patch + "': " + ioe);
} else { } else {
System.err.println("Error patching '" + target + "': " + ioe); log.warning("Error patching '" + target + "': " + ioe);
} }
} finally { } finally {