From 2bd10cf8a1647b15f15dfee07f73185a2e3aa20b Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 14 Sep 2018 15:00:55 -0700 Subject: [PATCH] Use logging system in code run "inside" Getdown. Command line tools may still use stdout/stderr directly. --- .../threerings/getdown/data/Application.java | 2 +- .../com/threerings/getdown/tools/Patcher.java | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/com/threerings/getdown/data/Application.java b/core/src/main/java/com/threerings/getdown/data/Application.java index 92262f1..54f4d54 100644 --- a/core/src/main/java/com/threerings/getdown/data/Application.java +++ b/core/src/main/java/com/threerings/getdown/data/Application.java @@ -1088,7 +1088,7 @@ public class Application log.info("Invoking main({" + StringUtil.join(args, ", ") + "})"); main.invoke(null, new Object[] { args }); } catch (Exception e) { - e.printStackTrace(System.err); + log.warning("Failure invoking app main", e); } } diff --git a/core/src/main/java/com/threerings/getdown/tools/Patcher.java b/core/src/main/java/com/threerings/getdown/tools/Patcher.java index 1bdcc98..60434f0 100644 --- a/core/src/main/java/com/threerings/getdown/tools/Patcher.java +++ b/core/src/main/java/com/threerings/getdown/tools/Patcher.java @@ -65,24 +65,24 @@ public class Patcher // depending on the suffix, we do The Right Thing (tm) if (path.endsWith(CREATE)) { path = strip(path, CREATE); - System.out.println("Creating " + path + "..."); + log.info("Creating " + path + "..."); createFile(file, entry, new File(appdir, path)); } else if (path.endsWith(PATCH)) { path = strip(path, PATCH); - System.out.println("Patching " + path + "..."); + log.info("Patching " + path + "..."); patchFile(file, entry, appdir, path); } else if (path.endsWith(DELETE)) { path = strip(path, DELETE); - System.out.println("Removing " + path + "..."); + log.info("Removing " + path + "..."); File target = new File(appdir, path); if (!FileUtil.deleteHarder(target)) { - System.err.println("Failure deleting '" + target + "'."); + log.warning("Failure deleting '" + target + "'."); } } 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 @@ -120,7 +120,7 @@ public class Patcher } } 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 if (!FileUtil.renameTo(target, otarget)) { - System.err.println("Failed to .oldify '" + target + "'."); + log.warning("Failed to .oldify '" + target + "'."); return; } @@ -162,9 +162,9 @@ public class Patcher } catch (IOException ioe) { if (patcher == null) { - System.err.println("Failed to write patch file '" + patch + "': " + ioe); + log.warning("Failed to write patch file '" + patch + "': " + ioe); } else { - System.err.println("Error patching '" + target + "': " + ioe); + log.warning("Error patching '" + target + "': " + ioe); } } finally {