From 97684b8630ae46201dfef997caa8b0a966ee8f2d 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.

---
 opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogger.java |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogger.java b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogger.java
index 37455d6..37be564 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogger.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/loggers/debug/DebugLogger.java
@@ -93,6 +93,14 @@
   // The singleton instance of this class for configuration purposes.
   static final DebugLogger instance = new DebugLogger();
 
+  static
+  {
+    // Add the default publisher to stdout.
+    addDebugLogPublisher(
+        TextDebugLogPublisher.getStartupTextDebugPublisher(
+            new TextWriter.STDOUT()));
+  }
+
   /**
    * Add an debug log publisher to the debug logger.
    *
@@ -152,6 +160,26 @@
   }
 
   /**
+   * Removes first debug log publisher from the logger.
+   */
+  public synchronized static void removeFirstDebugLogPublisher()
+  {
+    if(!debugPublishers.isEmpty())
+    {
+      DebugLogPublisher publisher = debugPublishers.remove(0);
+
+      publisher.close();
+    }
+
+    updateTracerSettings();
+
+    if(debugPublishers.isEmpty())
+    {
+      enabled = false;
+    }
+  }
+
+  /**
    * Initializes all the debug log publishers.
    *
    * @param  configs The debug log publisher configurations.

--
Gitblit v1.10.0