From 9575eaa5b0cb2e2f3f950ca1a70cb817f979d0b9 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Fri, 14 Mar 2008 22:34:11 +0000
Subject: [PATCH] Fixed the debug logger so it is enabled by default (error log level) for all tools and for the server itself on startup. The user can now use the org.opends.server.debug.* property to configure the debugging behavior anytime where the logger configuration is not obtained from the config file. This is discovered when it was not possible to see debug output from the verify-index tool to determine why the db was corrupt.

---
 opends/src/server/org/opends/server/loggers/ErrorLogger.java |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/loggers/ErrorLogger.java b/opends/src/server/org/opends/server/loggers/ErrorLogger.java
index deede00..7082c56 100644
--- a/opends/src/server/org/opends/server/loggers/ErrorLogger.java
+++ b/opends/src/server/org/opends/server/loggers/ErrorLogger.java
@@ -76,6 +76,14 @@
   // The singleton instance of this class for configuration purposes.
   private static final ErrorLogger instance = new ErrorLogger();
 
+  static
+  {
+    // Add the default publisher to stdout.
+    addErrorLogPublisher(
+        TextErrorLogPublisher.getStartupTextErrorPublisher(
+            new TextWriter.STDOUT()));
+  }
+
   /**
    * Retrieve the singleton instance of this class.
    *
@@ -130,6 +138,19 @@
   }
 
   /**
+   * Removes first error log publisher from the logger.
+   */
+  public synchronized static void removeFirstErrorLogPublisher()
+  {
+    if(!errorPublishers.isEmpty())
+    {
+      ErrorLogPublisher publisher = errorPublishers.remove(0);
+
+      publisher.close();
+    }
+  }
+
+  /**
    * Initializes all the error log publishers.
    *
    * @param configs The error log publisher configurations.

--
Gitblit v1.10.0