mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Violette Roche-Montane
03.27.2013 dcccc9d1b70be62288d1dd23f3084e6451354661
opends/src/server/org/opends/server/tools/upgrade/UpgradeLog.java
@@ -28,7 +28,10 @@
package org.opends.server.tools.upgrade;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.text.SimpleDateFormat;
import java.util.logging.FileHandler;
import java.util.logging.Formatter;
@@ -37,6 +40,9 @@
import java.util.logging.Logger;
import org.opends.messages.RuntimeMessages;
import org.opends.server.tools.ClientException;
import static org.opends.messages.ToolMessages.ERR_UPGRADE_INVALID_LOG_FILE;
/**
 * Creates a historical log about the upgrade. If file does not exist an attempt
@@ -104,4 +110,24 @@
    logger.log(Level.CONFIG, RuntimeMessages.NOTE_INSTANCE_DIRECTORY.get(
        UpgradeUtils.getInstancePath()).toString());
  }
  /**
   * Returns the print stream of the current logger.
   *
   * @return the print stream of the current logger.
   * @throws ClientException
   *           If the file defined by the logger is not found or invalid.
   */
  static PrintStream getPrintStream() throws ClientException
  {
    try
    {
      return new PrintStream(new FileOutputStream(logFile, true));
    }
    catch (FileNotFoundException e)
    {
      throw new ClientException(1, ERR_UPGRADE_INVALID_LOG_FILE.get(e
          .getMessage()));
    }
  }
}