From 2155def10e32885ae6f05fa8556bd9099c400f39 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Tue, 01 May 2007 21:47:07 +0000
Subject: [PATCH] This code introduces creation of a log file in the system's temporary directory for detailed log messages that can be used by any of the quicksetup applications (install, uninstall, upgrade). Right now logging if fairly meager but we should work on this soon. This work is being done in anticipation of changes that Brian has suggested in reducing the verbosity of the quicksetup applications. The idea is to put the details in the file and omit the messages in the progress panel details area (for instance messages about moving files around).
---
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java
index 7966c54..aa40450 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Launcher.java
@@ -32,6 +32,8 @@
import java.io.PrintStream;
import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.util.logging.Logger;
/**
* Responsible for providing initial evaluation of command line arguments
@@ -39,6 +41,8 @@
*/
public abstract class Launcher {
+ static private final Logger LOG = Logger.getLogger(Launcher.class.getName());
+
/** Arguments with which this launcher was invoked. */
protected String[] args;
@@ -107,6 +111,20 @@
}
/**
+ * Creates an internationaized message based on the input key and
+ * properly formatted for the terminal.
+ * @param key for the message in the bundle
+ * @param args String... arguments for the message
+ * @return String message properly formatted for the terminal
+ */
+ protected String getMsg(String key, String... args)
+ {
+ return org.opends.server.util.StaticUtils.wrapText(
+ getI18n().getMsg(key, args),
+ Utils.getCommandLineMaxLineWidth());
+ }
+
+ /**
* Prints a usage message to the terminal and exits
* with exit code QuickSetupCli.USER_DATA_ERROR.
* @param i18nMsg localized user message that will
@@ -240,6 +258,7 @@
printUsage();
} else if (isCli()) {
int exitCode = launchCli(args, createCliApplication());
+ preExit();
System.exit(exitCode);
} else {
willLaunchGui();
@@ -248,12 +267,21 @@
guiLaunchFailed();
exitCode = launchCli(args, createCliApplication());
if (exitCode != 0) {
+ preExit();
System.exit(exitCode);
}
}
}
}
+ private void preExit() {
+ File logFile = QuickSetupLog.getLogFile();
+ if (logFile != null) {
+ System.out.println(getMsg("general-see-for-details",
+ QuickSetupLog.getLogFile().getPath()));
+ }
+ }
+
/**
* This class is used to avoid displaying the error message related to display
* problems that we might have when trying to display the SplashWindow.
--
Gitblit v1.10.0