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

Matthew Swift
09.44.2012 c64d43ec6b73af879e69af99b11620459159a96a
Fix OPENDJ-438: Reduce verbosity of server.out during startup

Second attempt: use less verbose logger for server startup and more verbose loggers for tools, since if tools log something they probably want the user to see it, plus tools don't provide a means for configuring the log level.
10 files modified
100 ■■■■■ changed files
opends/src/quicksetup/org/opends/quicksetup/util/InProcessServerController.java 11 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/DirectoryServer.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/loggers/TextErrorLogPublisher.java 47 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/BackUpDB.java 9 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/ExportLDIF.java 9 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/ImportLDIF.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/RebuildIndex.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/RestoreDB.java 9 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/VerifyIndex.java 2 ●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java 5 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/util/InProcessServerController.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 */
package org.opends.quicksetup.util;
@@ -571,8 +572,8 @@
              TextDebugLogPublisher.getStartupTextDebugPublisher(debugWriter);
      DebugLogger.addDebugLogPublisher(startupDebugPublisher);
      startupErrorPublisher =
              TextErrorLogPublisher.getStartupTextErrorPublisher(errorWriter);
      startupErrorPublisher = TextErrorLogPublisher
          .getServerStartupTextErrorPublisher(errorWriter);
      ErrorLogger.addErrorLogPublisher(startupErrorPublisher);
      startupAccessPublisher =
@@ -586,12 +587,6 @@
    }
  }
  static private void unregisterListenersForOutput() {
    DebugLogger.removeDebugLogPublisher(startupDebugPublisher);
    ErrorLogger.removeErrorLogPublisher(startupErrorPublisher);
    AccessLogger.removeAccessLogPublisher(startupAccessPublisher);
  }
  /**
   * Compares two lists of attributes for equality.  Any non-user attributes
   * are ignored during comparison.
opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -9459,7 +9459,7 @@
    // Install the default loggers so the startup messages
    // will be printed.
    TextErrorLogPublisher startupErrorLogPublisher =
        TextErrorLogPublisher.getStartupTextErrorPublisher(
        TextErrorLogPublisher.getServerStartupTextErrorPublisher(
            new TextWriter.STDOUT());
    ErrorLogger.addErrorLogPublisher(startupErrorLogPublisher);
opends/src/server/org/opends/server/loggers/TextErrorLogPublisher.java
@@ -62,28 +62,53 @@
  private FileBasedErrorLogPublisherCfg currentConfig;
  /**
   * Returns an instance of the text error log publisher that will print
   * all messages to the provided writer. This is used to print the messages
   * to the console when the server starts up.
   * Returns a new text error log publisher which will print all messages to the
   * provided writer. This publisher should be used by tools.
   *
   * @param writer The text writer where the message will be written to.
   * @return The instance of the text error log publisher that will print
   * all messages to standard out.
   * @param writer
   *          The text writer where the message will be written to.
   * @return A new text error log publisher which will print all messages to the
   *         provided writer.
   */
  public static TextErrorLogPublisher
  getStartupTextErrorPublisher(TextWriter writer)
  public static TextErrorLogPublisher getToolStartupTextErrorPublisher(
      TextWriter writer)
  {
    TextErrorLogPublisher startupPublisher = new TextErrorLogPublisher();
    startupPublisher.writer = writer;
    startupPublisher.defaultSeverities.addAll(Arrays.asList(Severity.values()));
    return startupPublisher;
  }
  /**
   * Returns a new text error log publisher which will print only notices,
   * severe warnings and errors, and fatal errors messages to the provided
   * writer. This less verbose publisher should be used by the directory server
   * during startup.
   *
   * @param writer
   *          The text writer where the message will be written to.
   * @return A new text error log publisher which will print only notices,
   *         severe warnings and errors, and fatal errors messages to the
   *         provided writer.
   */
  public static TextErrorLogPublisher getServerStartupTextErrorPublisher(
      TextWriter writer)
  {
    TextErrorLogPublisher startupPublisher = new TextErrorLogPublisher();
    startupPublisher.writer = writer;
    startupPublisher.defaultSeverities.addAll(Arrays.asList(
        Severity.FATAL_ERROR,
        Severity.SEVERE_ERROR,
        Severity.SEVERE_WARNING,
        Severity.FATAL_ERROR, Severity.SEVERE_ERROR, Severity.SEVERE_WARNING,
        Severity.NOTICE));
    return startupPublisher;
  }
  /**
   * {@inheritDoc}
   */
opends/src/server/org/opends/server/tools/BackUpDB.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 */
package org.opends.server.tools;
import org.opends.messages.Message;
@@ -539,7 +540,7 @@
  /**
   * {@inheritDoc}
   */
  public Class getTaskClass() {
  public Class<?> getTaskClass() {
    return BackupTask.class;
  }
@@ -714,10 +715,10 @@
      try
      {
        ErrorLogPublisher errorLogPublisher =
            TextErrorLogPublisher.getStartupTextErrorPublisher(
        ErrorLogPublisher<?> errorLogPublisher =
            TextErrorLogPublisher.getToolStartupTextErrorPublisher(
            new TextWriter.STREAM(out));
        DebugLogPublisher debugLogPublisher =
        DebugLogPublisher<?> debugLogPublisher =
            TextDebugLogPublisher.getStartupTextDebugPublisher(
            new TextWriter.STREAM(out));
        ErrorLogger.addErrorLogPublisher(errorLogPublisher);
opends/src/server/org/opends/server/tools/ExportLDIF.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 */
package org.opends.server.tools;
@@ -497,7 +498,7 @@
  /**
   * {@inheritDoc}
   */
  public Class getTaskClass() {
  public Class<?> getTaskClass() {
    return ExportTask.class;
  }
@@ -631,10 +632,10 @@
      try
      {
        ErrorLogPublisher errorLogPublisher =
            TextErrorLogPublisher.getStartupTextErrorPublisher(
        ErrorLogPublisher<?> errorLogPublisher =
            TextErrorLogPublisher.getToolStartupTextErrorPublisher(
            new TextWriter.STREAM(out));
        DebugLogPublisher debugLogPublisher =
        DebugLogPublisher<?> debugLogPublisher =
            TextDebugLogPublisher.getStartupTextDebugPublisher(
            new TextWriter.STREAM(out));
        ErrorLogger.addErrorLogPublisher(errorLogPublisher);
opends/src/server/org/opends/server/tools/ImportLDIF.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011 ForgeRock AS.
 *      Portions copyright 2011-2012 ForgeRock AS.
 */
package org.opends.server.tools;
@@ -865,7 +865,7 @@
        try
        {
          ErrorLogPublisher<?> errorLogPublisher =
              TextErrorLogPublisher.getStartupTextErrorPublisher(
              TextErrorLogPublisher.getToolStartupTextErrorPublisher(
                  new TextWriter.STREAM(out));
          ErrorLogger.addErrorLogPublisher(errorLogPublisher);
        }
opends/src/server/org/opends/server/tools/RebuildIndex.java
@@ -430,7 +430,7 @@
      try
      {
        ErrorLogPublisher<?> errorLogPublisher =
            TextErrorLogPublisher.getStartupTextErrorPublisher(
            TextErrorLogPublisher.getToolStartupTextErrorPublisher(
            new TextWriter.STREAM(out));
        DebugLogPublisher<?> debugLogPublisher =
            TextDebugLogPublisher.getStartupTextDebugPublisher(
opends/src/server/org/opends/server/tools/RestoreDB.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 */
package org.opends.server.tools;
import org.opends.messages.Message;
@@ -328,7 +329,7 @@
  /**
   * {@inheritDoc}
   */
  public Class getTaskClass() {
  public Class<?> getTaskClass() {
    return RestoreTask.class;
  }
@@ -462,10 +463,10 @@
      try
      {
        ErrorLogPublisher errorLogPublisher =
            TextErrorLogPublisher.getStartupTextErrorPublisher(
        ErrorLogPublisher<?> errorLogPublisher =
            TextErrorLogPublisher.getToolStartupTextErrorPublisher(
            new TextWriter.STREAM(out));
        DebugLogPublisher debugLogPublisher =
        DebugLogPublisher<?> debugLogPublisher =
            TextDebugLogPublisher.getStartupTextDebugPublisher(
            new TextWriter.STREAM(out));
        ErrorLogger.addErrorLogPublisher(errorLogPublisher);
opends/src/server/org/opends/server/tools/VerifyIndex.java
@@ -378,7 +378,7 @@
      try
      {
        ErrorLogPublisher<?> errorLogPublisher =
            TextErrorLogPublisher.getStartupTextErrorPublisher(
            TextErrorLogPublisher.getToolStartupTextErrorPublisher(
            new TextWriter.STREAM(out));
        DebugLogPublisher<?> debugLogPublisher =
            TextDebugLogPublisher.getStartupTextDebugPublisher(
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 *      Portions Copyright 2011-2012 ForgeRock AS
 */
package org.opends.server;
@@ -525,8 +525,9 @@
          TextAccessLogPublisher.getStartupTextAccessPublisher(
              ACCESS_TEXT_WRITER, false));
      // Use more verbose tool logger.
      ErrorLogger.addErrorLogPublisher(
         TextErrorLogPublisher.getStartupTextErrorPublisher(
         TextErrorLogPublisher.getToolStartupTextErrorPublisher(
              ERROR_TEXT_WRITER));
      DebugLogger.addDebugLogPublisher(