From 0fd90c090279ef6219681098df77d0ec8cb0c5cf 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"

---
 opends/src/server/org/opends/server/util/RuntimeInformation.java |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 58 insertions(+), 1 deletions(-)

diff --git a/opends/src/server/org/opends/server/util/RuntimeInformation.java b/opends/src/server/org/opends/server/util/RuntimeInformation.java
index 3372d96..8026c09 100644
--- a/opends/src/server/org/opends/server/util/RuntimeInformation.java
+++ b/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