From 455897cc245b67d929f409a93cfa7106e835cc1f Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Thu, 01 Mar 2007 03:27:06 +0000
Subject: [PATCH] This removes old debug logging framework method calls that are going to be automatically instrumented by AspectJ. Non instrumented debug method calls are updated to use the new debug framework methods. However, the new debug logging framework is not yet active as the Aspects are not weaved in. After this revision, debug logging will be disabled in the server until the new AOP framework is complete. 

---
 opends/src/server/org/opends/server/loggers/LoggerThread.java |   40 ++++++++++++++++++++++------------------
 1 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/opends/src/server/org/opends/server/loggers/LoggerThread.java b/opends/src/server/org/opends/server/loggers/LoggerThread.java
index 30d035d..6583658 100644
--- a/opends/src/server/org/opends/server/loggers/LoggerThread.java
+++ b/opends/src/server/org/opends/server/loggers/LoggerThread.java
@@ -32,7 +32,9 @@
 import org.opends.server.api.ServerShutdownListener;
 import org.opends.server.core.DirectoryServer;
 
-import static org.opends.server.loggers.Debug.*;
+import static org.opends.server.loggers.debug.DebugLogger.debugCought;
+import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
+import org.opends.server.types.DebugLogLevel;
 
 /**
  * This class defines a thread that will be used for performing asynchronous
@@ -42,9 +44,6 @@
        implements ServerShutdownListener
 {
 
-  private static final String CLASS_NAME =
-    "org.opends.server.loggers.LoggerThread";
-
   private CopyOnWriteArrayList<RotationPolicy> rotationPolicies;
   private CopyOnWriteArrayList<RetentionPolicy> retentionPolicies;
   private LoggerAlarmHandler handler;
@@ -88,41 +87,44 @@
    */
   public void run()
   {
-    assert debugEnter(CLASS_NAME, "run");
+
 
     this.loggerThread = Thread.currentThread();
 
-    while(! stopRequested)
+    while (!stopRequested)
     {
       try
       {
         sleep(time);
       }
-      catch(InterruptedException e)
+      catch (InterruptedException e)
       {
         // We expect this to happen.
       }
-      catch(Exception e)
+      catch (Exception e)
       {
-        assert debugException(CLASS_NAME, "run", e);
+        if (debugEnabled())
+        {
+          debugCought(DebugLogLevel.ERROR, e);
+        }
       }
 
       handler.flush();
 
-      if(rotationPolicies != null)
+      if (rotationPolicies != null)
       {
-        for(RotationPolicy rotationPolicy : rotationPolicies)
+        for (RotationPolicy rotationPolicy : rotationPolicies)
         {
-          if(rotationPolicy.rotateFile())
+          if (rotationPolicy.rotateFile())
           {
             handler.rollover();
           }
         }
       }
 
-      if(retentionPolicies != null)
+      if (retentionPolicies != null)
       {
-        for(RetentionPolicy retentionPolicy : retentionPolicies)
+        for (RetentionPolicy retentionPolicy : retentionPolicies)
         {
           int numFilesDeleted = retentionPolicy.deleteFiles();
           System.out.println(numFilesDeleted + " files deleted");
@@ -140,7 +142,7 @@
    */
   public String getShutdownListenerName()
   {
-    assert debugEnter(CLASS_NAME, "getShutdownListenerName");
+
 
     return "Logger Thread " + getName();
   }
@@ -156,8 +158,7 @@
    */
   public void processServerShutdown(String reason)
   {
-    assert debugEnter(CLASS_NAME, "processServerShutdown",
-                      String.valueOf(reason));
+
 
     stopRequested = true;
 
@@ -170,7 +171,10 @@
     }
     catch (Exception e)
     {
-      assert debugException(CLASS_NAME, "processServerShutdown", e);
+      if (debugEnabled())
+      {
+        debugCought(DebugLogLevel.ERROR, e);
+      }
     }
   }
 }

--
Gitblit v1.10.0