From 89db3db746c7615dd7e46600622b31d4a3aa32c8 Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Tue, 17 Feb 2009 14:21:24 +0000
Subject: [PATCH] Fix for issue #3797 (OpenDS should log it's instance path at startup.) Two new msgs are added. These msg are printed out     * when the server is started:     * by "start-ds -s"

---
 opendj-sdk/opends/src/messages/messages/runtime_information.properties      |    7 +++
 opendj-sdk/opends/src/server/org/opends/server/util/RuntimeInformation.java |   59 +++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/opendj-sdk/opends/src/messages/messages/runtime_information.properties b/opendj-sdk/opends/src/messages/messages/runtime_information.properties
index c1697bd..a32c86c 100644
--- a/opendj-sdk/opends/src/messages/messages/runtime_information.properties
+++ b/opendj-sdk/opends/src/messages/messages/runtime_information.properties
@@ -20,7 +20,7 @@
 #
 # CDDL HEADER END
 #
-#      Copyright 2006-2008 Sun Microsystems, Inc.
+#      Copyright 2006-2009 Sun Microsystems, Inc.
 
 
 
@@ -73,4 +73,9 @@
 NOTICE_JVM_HOST_WITH_UNKNOWN_PHYSICAL_MEM_20=JVM Host: %s, running %s, \
                    unknown physical memory size, \
                    number of processors available %d
+NOTICE_INSTALL_DIRECTORY_21=Installation Directory:  %s
+NOTICE_UNKNOWN_INSTALL_DIRECTORY_22=Installation Directory:  unknown
+NOTICE_INSTANCE_DIRECTORY_23=Instance Directory:      %s
+NOTICE_UNKNOWN_INSTANCE_DIRECTORY_24=Instance Directory:      unknown
+
 
diff --git a/opendj-sdk/opends/src/server/org/opends/server/util/RuntimeInformation.java b/opendj-sdk/opends/src/server/org/opends/server/util/RuntimeInformation.java
index 3372d96..8026c09 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/util/RuntimeInformation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/util/RuntimeInformation.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2008 Sun Microsystems, Inc.
+ *      Copyright 2008-2009 Sun Microsystems, Inc.
  */
 
  package org.opends.server.util;
@@ -32,6 +32,7 @@
  import static org.opends.server.util.DynamicConstants.*;
  import org.opends.server.core.DirectoryServer;
  import java.net.InetAddress;
+import java.io.File;
  import java.lang.management.RuntimeMXBean;
  import java.lang.management.ManagementFactory;
  import java.util.List;
@@ -123,6 +124,34 @@
              NOTE_JE_VERSION.get(JEVersion.CURRENT_VERSION.toString()));
      System.out.println(
              NOTE_CURRENT_DIRECTORY.get(System.getProperty("user.dir")));
+     String installDir = DirectoryServer.getServerRoot();
+     try
+     {
+       installDir = new File(installDir).getCanonicalPath();
+     }
+     catch (Exception e){}
+     if (installDir == null)
+     {
+       System.out.println(NOTE_UNKNOWN_INSTALL_DIRECTORY.get());
+     }
+     else
+     {
+       System.out.println(NOTE_INSTALL_DIRECTORY.get(installDir));
+     }
+     String instanceDir = DirectoryServer.getInstanceRoot();
+     try
+     {
+       instanceDir = new File(instanceDir).getCanonicalPath();
+     }
+     catch (Exception e){}
+     if (instanceDir == null)
+     {
+       System.out.println(NOTE_UNKNOWN_INSTANCE_DIRECTORY.get());
+     }
+     else
+     {
+       System.out.println(NOTE_INSTANCE_DIRECTORY.get(instanceDir));
+     }
      System.out.println(
              NOTE_OPERATING_SYSTEM.get(System.getProperty("os.name") + " " +
                      System.getProperty("os.version") + " " +
@@ -234,6 +263,34 @@
     * Write runtime information to error log.
     */
    public static void logInfo() {
+     String installDir = DirectoryServer.getServerRoot();
+     try
+     {
+       installDir = new File(installDir).getCanonicalPath();
+     }
+     catch (Exception e){}
+     if (installDir == null)
+     {
+       logError(NOTE_UNKNOWN_INSTALL_DIRECTORY.get());
+     }
+     else
+     {
+       logError(NOTE_INSTALL_DIRECTORY.get(installDir));
+     }
+     String instanceDir = DirectoryServer.getInstanceRoot();
+     try
+     {
+       instanceDir = new File(instanceDir).getCanonicalPath();
+     }
+     catch (Exception e){}
+     if (instanceDir == null)
+     {
+       logError(NOTE_UNKNOWN_INSTANCE_DIRECTORY.get());
+     }
+     else
+     {
+       logError(NOTE_INSTANCE_DIRECTORY.get(instanceDir));
+     }
     logError(NOTE_JVM_INFO.get(System.getProperty("java.runtime.version"),
                                System.getProperty("java.vendor"),
                                getArch(),Runtime.getRuntime().maxMemory()));

--
Gitblit v1.10.0