From 22542acc2f7a03a735ae73c49c09252068ebc86d Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Thu, 30 Jan 2014 13:38:30 +0000
Subject: [PATCH] Checkpoint commit for OPENDJ-1288 :    Migrate I18n and logging support to i18n framework and SLF4J

---
 opendj3-server-dev/src/server/org/opends/server/api/DebugLogPublisher.java                                    |   19 
 opendj3-server-dev/src/server/org/opends/server/loggers/AbstractTextAccessLogPublisher.java                   |    2 
 opendj3-server-dev/src/server/org/opends/server/loggers/AbstractLogger.java                                   |   17 
 opendj3-server-dev/src/server/org/opends/server/loggers/LogFileFilter.java                                    |    3 
 opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java                    |    2 
 opendj3-server-dev/src/server/org/opends/server/tools/BackUpDB.java                                           |    6 
 opendj3-server-dev/src/server/org/opends/server/tools/RebuildIndex.java                                       |    7 
 opendj3-server-dev/src/server/org/opends/server/tools/RestoreDB.java                                          |    8 
 opendj3-server-dev/src/server/org/opends/server/loggers/TextDebugLogPublisher.java                            |   44 --
 opendj3-server-dev/src/server/org/opends/server/loggers/LogPublisherErrorHandler.java                         |    2 
 opendj3-server-dev/src/server/org/opends/server/loggers/TraceSettings.java                                    |    6 
 opendj3-server-dev/src/server/org/opends/server/loggers/LoggerAlarmHandler.java                               |    3 
 opendj3-server-dev/src/server/org/opends/server/core/LoggerConfigManager.java                                 |    4 
 opendj3-server-dev/src/server/org/opends/server/loggers/package-info.java                                     |    5 
 opendj3-server-dev/src/server/org/opends/server/loggers/DebugTracer.java                                      |  328 +++++++++++++++++++++
 opendj3-server-dev/src/server/org/opends/server/tools/ConsoleDebugLogPublisher.java                           |   29 -
 opendj3-server-dev/src/server/org/opends/server/loggers/DebugLogger.java                                      |   19 -
 opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/tasks/TestBackupAndRestore.java       |    3 
 opendj3-server-dev/src/server/org/opends/server/loggers/PostRotationAction.java                               |    3 
 opendj3-server-dev/src/server/org/opends/server/loggers/LoggingCategoryNames.java                             |  142 +++++++++
 opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/FileBasedAccessLogPublisherConfiguration.xml    |    8 
 opendj3-server-dev/src/server/org/opends/server/loggers/DebugStackTraceFormatter.java                         |    3 
 opendj3-server-dev/src/server/org/opends/server/loggers/ParallelTextWriter.java                               |    2 
 opendj3-server-dev/src/server/org/opends/server/loggers/FileComparator.java                                   |    3 
 opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java                                     |    4 
 /dev/null                                                                                                     |   44 --
 opendj3-server-dev/resource/config/config.ldif                                                                |    2 
 opendj3-server-dev/src/server/org/opends/server/loggers/GZIPAction.java                                       |    2 
 opendj3-server-dev/src/server/org/opends/server/tools/VerifyIndex.java                                        |    7 
 opendj3-server-dev/src/server/org/opends/server/tools/LDAPConnection.java                                     |    4 
 opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/FileBasedDebugLogPublisherConfiguration.xml     |    7 
 opendj3-server-dev/src/server/org/opends/server/loggers/EncryptAction.java                                    |    3 
 opendj3-server-dev/ivy.xml                                                                                    |    6 
 opendj3-server-dev/src/server/org/opends/server/tools/ExportLDIF.java                                         |   11 
 opendj3-server-dev/src/server/org/opends/server/loggers/AsynchronousTextWriter.java                           |    2 
 opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/loggers/LoggingCategoryNamesTest.java |   76 +++++
 opendj3-server-dev/src/server/org/opends/server/loggers/MultifileTextWriter.java                              |    2 
 opendj3-server-dev/src/server/org/opends/server/loggers/DebugMessageFormatter.java                            |   10 
 38 files changed, 651 insertions(+), 197 deletions(-)

diff --git a/opendj3-server-dev/ivy.xml b/opendj3-server-dev/ivy.xml
index 17147e3..95dd79f 100644
--- a/opendj3-server-dev/ivy.xml
+++ b/opendj3-server-dev/ivy.xml
@@ -51,11 +51,11 @@
     <dependency org="javax.servlet"         name="javax.servlet-api"        rev="[3.1-b02]" />
     <dependency org="com.sleepycat"         name="je"                       rev="5.0.97" />
     <dependency org="org.forgerock.opendj"  name="opendj-rest2ldap-servlet" rev="&opendj.sdk.version;" conf="default->master,compile" />
-    <dependency org="org.forgerock.opendj"  name="opendj-slf4j-adapter" rev="&opendj.sdk.version;" />
+    <!--  <dependency org="org.forgerock.opendj"  name="opendj-slf4j-adapter" rev="&opendj.sdk.version;" /> -->
     <dependency org="org.forgerock.commons"  name="i18n-slf4j"  rev="&i18n.version;" />
     <dependency org="org.forgerock.opendj"  name="opendj-server2x-adapter"  rev="&opendj.sdk.version;" />
-    <dependency org="org.glassfish.grizzly" name="grizzly-http-servlet"     rev="&grizzly.version;"> 	
-      <exclude module="javax.servlet-api" /> 	
+    <dependency org="org.glassfish.grizzly" name="grizzly-http-servlet"     rev="&grizzly.version;">
+      <exclude module="javax.servlet-api" />
     </dependency>
 
     <!-- Test libs -->
diff --git a/opendj3-server-dev/resource/config/config.ldif b/opendj3-server-dev/resource/config/config.ldif
index dd2d7a4..1d5ce70 100644
--- a/opendj3-server-dev/resource/config/config.ldif
+++ b/opendj3-server-dev/resource/config/config.ldif
@@ -800,7 +800,7 @@
 objectClass: ds-cfg-debug-log-publisher
 objectClass: ds-cfg-file-based-debug-log-publisher
 cn: File-Based Debug Logger
-ds-cfg-java-class: org.opends.server.loggers.debug.TextDebugLogPublisher
+ds-cfg-java-class: org.opends.server.loggers.TextDebugLogPublisher
 ds-cfg-enabled: false
 ds-cfg-log-file: logs/debug
 ds-cfg-log-file-permissions: 640
diff --git a/opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/FileBasedAccessLogPublisherConfiguration.xml b/opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/FileBasedAccessLogPublisherConfiguration.xml
index 733e3f1..f6f8c2f 100644
--- a/opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/FileBasedAccessLogPublisherConfiguration.xml
+++ b/opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/FileBasedAccessLogPublisherConfiguration.xml
@@ -23,7 +23,7 @@
   !
   !
   !      Copyright 2007-2009 Sun Microsystems, Inc.
-  !      Portions copyright 2011 ForgeRock AS.
+  !      Portions copyright 2011-2014 ForgeRock AS.
   ! -->
 <adm:managed-object name="file-based-access-log-publisher"
   plural-name="file-based-access-log-publishers"
@@ -83,7 +83,7 @@
     <adm:requires-admin-action>
       <adm:other>
         <adm:synopsis>
-          The <adm:user-friendly-name /> must be restarted if this property 
+          The <adm:user-friendly-name /> must be restarted if this property
           is changed and the asynchronous property is set to true.
         </adm:synopsis>
       </adm:other>
@@ -158,7 +158,7 @@
   </adm:property>
   <adm:property name="time-interval" advanced="true">
     <adm:synopsis>
-      Specifies the interval at which to check whether the log files 
+      Specifies the interval at which to check whether the log files
       need to be rotated.
     </adm:synopsis>
     <adm:default-behavior>
@@ -332,7 +332,7 @@
         <adm:regex>.*</adm:regex>
         <adm:usage>STRING</adm:usage>
           <adm:synopsis>
-            Any valid format string that can be used with the 
+            Any valid format string that can be used with the
             java.text.SimpleDateFormat class.
           </adm:synopsis>
         </adm:pattern>
diff --git a/opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/FileBasedDebugLogPublisherConfiguration.xml b/opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/FileBasedDebugLogPublisherConfiguration.xml
index 991a7e8..742399e 100644
--- a/opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/FileBasedDebugLogPublisherConfiguration.xml
+++ b/opendj3-server-dev/src/admin/defn/org/opends/server/admin/std/FileBasedDebugLogPublisherConfiguration.xml
@@ -23,6 +23,7 @@
   !
   !
   !      Copyright 2007-2008 Sun Microsystems, Inc.
+  !      Portions Copyright 2014 ForgeRock AS.
   ! -->
 <adm:managed-object name="file-based-debug-log-publisher"
   plural-name="file-based-debug-log-publishers"
@@ -43,7 +44,7 @@
     <adm:default-behavior>
       <adm:defined>
         <adm:value>
-          org.opends.server.loggers.debug.TextDebugLogPublisher
+          org.opends.server.loggers.TextDebugLogPublisher
         </adm:value>
       </adm:defined>
     </adm:default-behavior>
@@ -139,7 +140,7 @@
   </adm:property>
   <adm:property name="time-interval" advanced="true">
     <adm:synopsis>
-      Specifies the interval at which to check whether the log files 
+      Specifies the interval at which to check whether the log files
       need to be rotated.
     </adm:synopsis>
     <adm:default-behavior>
@@ -252,7 +253,7 @@
     <adm:default-behavior>
       <adm:alias>
         <adm:synopsis>
-          No retention policy is used and log files are never 
+          No retention policy is used and log files are never
           cleaned.
         </adm:synopsis>
       </adm:alias>
diff --git a/opendj3-server-dev/src/server/org/opends/server/api/DebugLogPublisher.java b/opendj3-server-dev/src/server/org/opends/server/api/DebugLogPublisher.java
index da1a4e7..259e49b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/api/DebugLogPublisher.java
+++ b/opendj3-server-dev/src/server/org/opends/server/api/DebugLogPublisher.java
@@ -33,7 +33,7 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.opends.server.admin.std.server.DebugLogPublisherCfg;
-import org.opends.server.loggers.debug.TraceSettings;
+import org.opends.server.loggers.TraceSettings;
 import org.opends.server.types.DebugLogLevel;
 
 /**
@@ -347,11 +347,8 @@
    * @param  stackTrace      The stack trace at the time the message
    *                         is logged or null if its not available.
    */
-  public abstract void traceMessage(TraceSettings settings,
-                                    String signature,
-                                    String sourceLocation,
-                                    String msg,
-                                    StackTraceElement[] stackTrace);
+  public abstract void trace(TraceSettings settings, String signature,
+      String sourceLocation, String msg, StackTraceElement[] stackTrace);
 
 
 
@@ -360,15 +357,13 @@
    * @param  settings        The current trace settings in effect.
    * @param  signature       The method signature.
    * @param  sourceLocation  The location of the method in the source.
-   * @param msg TODO
+   * @param  msg             The message to be logged.
    * @param  ex              The exception that was caught.
    * @param  stackTrace      The stack trace at the time the exception
    *                         is caught or null if its not available.
    */
-  public abstract void traceCaught(TraceSettings settings,
-                                   String signature,
-                                   String sourceLocation,
-                                   String msg,
-                                   Throwable ex, StackTraceElement[] stackTrace);
+  public abstract void traceException(TraceSettings settings, String signature,
+      String sourceLocation, String msg, Throwable ex,
+      StackTraceElement[] stackTrace);
 
 }
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java b/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
index 8b013d7..4ee8f9a 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
@@ -31,8 +31,8 @@
 import static org.opends.messages.ToolMessages.*;
 import static org.opends.server.config.ConfigConstants.*;
 import static org.opends.server.loggers.AccessLogger.*;
+import static org.opends.server.loggers.DebugLogger.*;
 import static org.opends.server.loggers.ErrorLogger.*;
-import static org.opends.server.loggers.debug.DebugLogger.*;
 import static org.opends.server.schema.SchemaConstants.*;
 import static org.opends.server.util.DynamicConstants.*;
 import static org.opends.server.util.ServerConstants.*;
@@ -77,9 +77,7 @@
 import org.opends.server.extensions.ConfigFileHandler;
 import org.opends.server.extensions.JMXAlertHandler;
 import org.opends.server.loggers.*;
-import org.opends.server.loggers.debug.DebugLogger;
 import org.forgerock.i18n.slf4j.LocalizedLogger;
-import org.opends.server.loggers.debug.TextDebugLogPublisher;
 import org.opends.server.monitors.BackendMonitor;
 import org.opends.server.monitors.ConnectionHandlerMonitor;
 import org.opends.server.protocols.internal.InternalClientConnection;
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/LoggerConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/core/LoggerConfigManager.java
index 92b3161..becd6fa 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/LoggerConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/LoggerConfigManager.java
@@ -27,7 +27,9 @@
 package org.opends.server.core;
 
 import static org.opends.messages.ConfigMessages.*;
+
 import org.forgerock.i18n.slf4j.LocalizedLogger;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -44,9 +46,9 @@
 import org.opends.server.config.ConfigException;
 import org.opends.server.loggers.AbstractLogger;
 import org.opends.server.loggers.AccessLogger;
+import org.opends.server.loggers.DebugLogger;
 import org.opends.server.loggers.ErrorLogger;
 import org.opends.server.loggers.HTTPAccessLogger;
-import org.opends.server.loggers.debug.DebugLogger;
 import org.opends.server.types.ConfigChangeResult;
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/AbstractLogger.java b/opendj3-server-dev/src/server/org/opends/server/loggers/AbstractLogger.java
index 3055502..095105a 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/AbstractLogger.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/AbstractLogger.java
@@ -36,6 +36,7 @@
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageDescriptor.Arg3;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.admin.ClassPropertyDefinition;
 import org.opends.server.admin.server.ConfigurationAddListener;
 import org.opends.server.admin.server.ConfigurationChangeListener;
@@ -45,10 +46,8 @@
 import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.ServerContext;
-import org.opends.server.loggers.debug.DebugLogger;
 import org.opends.server.types.ConfigChangeResult;
 import org.opends.server.types.DN;
-import org.opends.server.types.DebugLogLevel;
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 import org.opends.server.util.StaticUtils;
@@ -69,6 +68,8 @@
     ConfigurationChangeListener<C>
 {
 
+  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
+
   /**
    * The storage designed to store log publishers. It is helpful in abstracting
    * away the methods used to manage the collection.
@@ -257,13 +258,13 @@
       }
       catch(ConfigException e)
       {
-        debugCaught(DebugLogLevel.ERROR, e);
+        logger.traceException(e);
         messages.add(e.getMessageObject());
         resultCode = DirectoryServer.getServerErrorResultCode();
       }
       catch (Exception e)
       {
-        debugCaught(DebugLogLevel.ERROR, e);
+        logger.traceException(e);
         messages.add(ERR_CONFIG_LOGGER_CANNOT_CREATE_LOGGER.get(
                 String.valueOf(config.dn().toString()),
                 stackTraceToSingleLineString(e)));
@@ -273,14 +274,6 @@
     return new ConfigChangeResult(resultCode, adminActionRequired, messages);
   }
 
-  private void debugCaught(LogLevel error, Exception e)
-  {
-    if (DebugLogger.debugEnabled())
-    {
-      DebugLogger.getTracer().debugCaught(DebugLogLevel.ERROR, e);
-    }
-  }
-
   private P findLogPublisher(DN dn)
   {
     Collection<P> logPublishers = getStorage().getLogPublishers();
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/AbstractTextAccessLogPublisher.java b/opendj3-server-dev/src/server/org/opends/server/loggers/AbstractTextAccessLogPublisher.java
index 03931d3..543c0f5 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/AbstractTextAccessLogPublisher.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/AbstractTextAccessLogPublisher.java
@@ -62,7 +62,7 @@
  * @param <T>
  *          The type of access log publisher configuration.
  */
-public abstract class AbstractTextAccessLogPublisher
+abstract class AbstractTextAccessLogPublisher
     <T extends AccessLogPublisherCfg> extends AccessLogPublisher<T>
 {
   /**
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/AsynchronousTextWriter.java b/opendj3-server-dev/src/server/org/opends/server/loggers/AsynchronousTextWriter.java
index f5b6dc5..7ae4bb6 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/AsynchronousTextWriter.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/AsynchronousTextWriter.java
@@ -40,7 +40,7 @@
  * A Text Writer which writes log records asynchronously to
  * character-based stream.
  */
-public class AsynchronousTextWriter
+class AsynchronousTextWriter
     implements ServerShutdownListener, TextWriter
 {
   /**
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/debug/DebugLogger.java b/opendj3-server-dev/src/server/org/opends/server/loggers/DebugLogger.java
similarity index 91%
rename from opendj3-server-dev/src/server/org/opends/server/loggers/debug/DebugLogger.java
rename to opendj3-server-dev/src/server/org/opends/server/loggers/DebugLogger.java
index c5f23da..7100bb2 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/debug/DebugLogger.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/DebugLogger.java
@@ -24,7 +24,7 @@
  *      Copyright 2007-2009 Sun Microsystems, Inc.
  *      Portions Copyright 2013-2014 ForgeRock AS
  */
-package org.opends.server.loggers.debug;
+package org.opends.server.loggers;
 
 import static org.opends.messages.ConfigMessages.*;
 
@@ -35,7 +35,6 @@
 import org.opends.server.admin.std.meta.DebugLogPublisherCfgDefn;
 import org.opends.server.admin.std.server.DebugLogPublisherCfg;
 import org.opends.server.api.DebugLogPublisher;
-import org.opends.server.loggers.AbstractLogger;
 
 /**
  * A logger for debug and trace logging. DebugLogger provides a debugging
@@ -161,7 +160,7 @@
    *
    * @return True if debug logging is enabled. False otherwise.
    */
-  public static boolean debugEnabled()
+  static boolean debugEnabled()
   {
     return enabled;
   }
@@ -177,25 +176,13 @@
   }
 
   /**
-   * Creates a new Debug Tracer for the caller class and registers it
-   * with the Debug Logger.
-   *
-   * @return The tracer created for the caller class.
-   */
-  public static DebugTracer getTracer()
-  {
-    // TODO : remove this method
-    return getTracer("org.opends");
-  }
-
-  /**
    * Returns the registered Debug Tracer for a traced class.
    *
    * @param className The name of the class tracer to retrieve.
    * @return The tracer for the provided class or null if there are
    *         no tracers registered.
    */
-  public static DebugTracer getTracer(String className)
+  static DebugTracer getTracer(final String className)
   {
     DebugTracer tracer = classTracers.get(className);
     if (tracer == null)
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/debug/DebugMessageFormatter.java b/opendj3-server-dev/src/server/org/opends/server/loggers/DebugMessageFormatter.java
similarity index 96%
rename from opendj3-server-dev/src/server/org/opends/server/loggers/debug/DebugMessageFormatter.java
rename to opendj3-server-dev/src/server/org/opends/server/loggers/DebugMessageFormatter.java
index f999893..d07d71f 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/debug/DebugMessageFormatter.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/DebugMessageFormatter.java
@@ -22,8 +22,9 @@
  *
  *
  *      Copyright 2006-2008 Sun Microsystems, Inc.
+ *      Portions Copyright 2014 ForgeRock AS.
  */
-package org.opends.server.loggers.debug;
+package org.opends.server.loggers;
 
 import java.util.*;
 
@@ -133,7 +134,6 @@
   {
     StringBuilder buffer= new StringBuilder();
     buffer.append("[ ");
-    boolean firstElement= true;
     for (int i= 0; i < array.length; i++) {
       if (i > 0) buffer.append(", ");
       buffer.append(array[i]);
@@ -147,7 +147,6 @@
   {
     StringBuilder buffer= new StringBuilder();
     buffer.append("[ ");
-    boolean firstElement= true;
     for (int i= 0; i < array.length; i++) {
       if (i > 0) buffer.append(", ");
       buffer.append(array[i]);
@@ -161,7 +160,6 @@
   {
     StringBuilder buffer= new StringBuilder();
     buffer.append("[ ");
-    boolean firstElement= true;
     for (int i= 0; i < array.length; i++) {
       if (i > 0) buffer.append(", ");
       buffer.append(array[i]);
@@ -175,7 +173,6 @@
   {
     StringBuilder buffer= new StringBuilder();
     buffer.append("[ ");
-    boolean firstElement= true;
     for (int i= 0; i < array.length; i++) {
       if (i > 0) buffer.append(", ");
       buffer.append(array[i]);
@@ -189,7 +186,6 @@
   {
     StringBuilder buffer= new StringBuilder();
     buffer.append("[ ");
-    boolean firstElement= true;
     for (int i= 0; i < array.length; i++) {
       if (i > 0) buffer.append(", ");
       buffer.append(array[i]);
@@ -203,7 +199,6 @@
   {
     StringBuilder buffer= new StringBuilder();
     buffer.append("[ ");
-    boolean firstElement= true;
     for (int i= 0; i < array.length; i++) {
       if (i > 0) buffer.append(", ");
       buffer.append(array[i]);
@@ -217,7 +212,6 @@
   {
     StringBuilder buffer= new StringBuilder();
     buffer.append("[ ");
-    boolean firstElement= true;
     for (int i= 0; i < array.length; i++) {
       if (i > 0) buffer.append(", ");
       buffer.append(array[i]);
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/debug/DebugStackTraceFormatter.java b/opendj3-server-dev/src/server/org/opends/server/loggers/DebugStackTraceFormatter.java
similarity index 98%
rename from opendj3-server-dev/src/server/org/opends/server/loggers/debug/DebugStackTraceFormatter.java
rename to opendj3-server-dev/src/server/org/opends/server/loggers/DebugStackTraceFormatter.java
index eee4c7d..45b2953 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/debug/DebugStackTraceFormatter.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/DebugStackTraceFormatter.java
@@ -22,8 +22,9 @@
  *
  *
  *      Copyright 2006-2008 Sun Microsystems, Inc.
+ *      Portions Copyright 2014 ForgeRock AS.
  */
-package org.opends.server.loggers.debug;
+package org.opends.server.loggers;
 
 import static org.opends.server.util.ServerConstants.EOL;
 
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/DebugTracer.java b/opendj3-server-dev/src/server/org/opends/server/loggers/DebugTracer.java
new file mode 100644
index 0000000..d02e4e3
--- /dev/null
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/DebugTracer.java
@@ -0,0 +1,328 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2006-2009 Sun Microsystems, Inc.
+ *      Portions Copyright 2014 ForgeRock AS
+ */
+package org.opends.server.loggers;
+
+import java.util.Map;
+
+import org.opends.server.api.DebugLogPublisher;
+import org.opends.server.types.DebugLogCategory;
+
+/**
+ * Class for source-code tracing at the method level.
+ *
+ * One DebugTracer instance exists for each Java class using tracing.
+ * Tracer must be registered with the DebugLogger.
+ *
+ * Logging is always done at a level basis, with debug log messages
+ * exceeding the trace threshold being traced, others being discarded.
+ */
+class DebugTracer
+{
+  /** The class this aspect traces. */
+  private String className;
+
+  /**
+   * A class that represents a settings cache entry.
+   */
+  private class PublisherSettings
+  {
+    DebugLogPublisher<?> debugPublisher;
+    TraceSettings classSettings;
+    Map<String, TraceSettings> methodSettings;
+  }
+
+  private PublisherSettings[] publisherSettings;
+
+  /**
+   * Construct a new DebugTracer object with cached settings obtained from
+   * the provided array of publishers.
+   *
+   * @param className The classname to use as category for logging.
+   * @param publishers The array of publishers to obtain the settings from.
+   */
+  @SuppressWarnings({ "unchecked", "rawtypes" })
+  DebugTracer(String className, DebugLogPublisher[] publishers)
+  {
+    this.className = className;
+    publisherSettings = new PublisherSettings[publishers.length];
+
+    // Get the settings from all publishers.
+    for(int i = 0; i < publishers.length; i++)
+    {
+      DebugLogPublisher publisher = publishers[i];
+      PublisherSettings settings = new PublisherSettings();
+
+      settings.debugPublisher = publisher;
+      settings.classSettings = publisher.getClassSettings(className);
+
+      // For some reason, the compiler doesn't see that
+      // debugLogPublihser.getMethodSettings returns a parameterized Map.
+      // This problem goes away if a parameterized verson of DebugLogPublisher
+      // is used. However, we can't not use reflection to instantiate a generic
+      // DebugLogPublisher<? extends DebugLogPublisherCfg> type. The only thing
+      // we can do is to just supress the compiler warnings.
+      settings.methodSettings = publisher.getMethodSettings(className);
+
+      publisherSettings[i] = settings;
+    }
+  }
+
+  /**
+   * Log the provided message.
+   *
+   * @param msg
+   *          message to log.
+   */
+  void trace(String msg)
+  {
+    traceException(msg, null);
+  }
+
+  /**
+   * Log the provided message and exception.
+   *
+   * @param msg
+   *          the message
+   * @param exception
+   *          the exception caught. May be {@code null}.
+   */
+  void traceException(String msg, Throwable exception)
+  {
+    if(DebugLogger.debugEnabled())
+    {
+      StackTraceElement[] stackTrace = null;
+      StackTraceElement[] filteredStackTrace = null;
+      StackTraceElement callerFrame = null;
+      for (PublisherSettings settings : publisherSettings)
+      {
+        TraceSettings activeSettings = settings.classSettings;
+        Map<String, TraceSettings> methodSettings = settings.methodSettings;
+
+        if (shouldLog(DebugLogCategory.CAUGHT, activeSettings) || methodSettings != null)
+        {
+          if(stackTrace == null)
+          {
+            stackTrace = Thread.currentThread().getStackTrace();
+          }
+          if (callerFrame == null)
+          {
+            callerFrame = getCallerFrame(stackTrace);
+          }
+
+          String signature = callerFrame.getMethodName();
+
+          // Specific method settings still could exist. Try getting
+          // the settings for this method.
+          if(methodSettings != null)
+          {
+            TraceSettings mSettings = methodSettings.get(signature);
+
+            if (mSettings == null)
+            {
+              // Try looking for an undecorated method name
+              int idx = signature.indexOf('(');
+              if (idx != -1)
+              {
+                mSettings =
+                    methodSettings.get(signature.substring(0, idx));
+              }
+            }
+
+            // If this method does have a specific setting and it is not
+            // suppose to be logged, continue.
+            if (mSettings != null)
+            {
+              if(!shouldLog(DebugLogCategory.CAUGHT, mSettings))
+              {
+                continue;
+              }
+              else
+              {
+                activeSettings = mSettings;
+              }
+            }
+          }
+
+          String sourceLocation = callerFrame.getFileName() + ":" +
+              callerFrame.getLineNumber();
+
+          if (filteredStackTrace == null && activeSettings.stackDepth > 0)
+          {
+            StackTraceElement[] trace = exception == null ? stackTrace : exception.getStackTrace();
+            filteredStackTrace =
+                DebugStackTraceFormatter.SMART_FRAME_FILTER.
+                    getFilteredStackTrace(trace);
+          }
+
+          if (exception == null)
+          {
+            settings.debugPublisher.trace(activeSettings, signature,
+                sourceLocation, msg, filteredStackTrace);
+          }
+          else
+          {
+            settings.debugPublisher.traceException(activeSettings, signature,
+                sourceLocation, msg, exception, filteredStackTrace);
+          }
+        }
+      }
+    }
+  }
+
+  /**
+   * Gets the name of the class this tracer traces.
+   *
+   * @return The name of the class this tracer traces.
+   */
+  String getTracedClassName()
+  {
+    return className;
+  }
+
+  /**
+   * Indicates if logging is enabled for the provided debug log
+   * category.
+   *
+   * @param logCategory
+   *            Log category to check
+   * @return {@code true} if logging is enabled, false otherwise.
+   */
+  boolean enabledFor(LogCategory logCategory)
+  {
+    for (PublisherSettings settings : publisherSettings)
+    {
+      TraceSettings activeSettings = settings.classSettings;
+      Map<String, TraceSettings> methodSettings = settings.methodSettings;
+
+      if (shouldLog(logCategory, activeSettings)
+          || methodSettings != null)
+      {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
+   * Indicates if logging is enabled for at least one category
+   * in a publisher.
+   *
+   * @return {@code true} if logging is enabled, false otherwise.
+   */
+  boolean enabled()
+  {
+    for (PublisherSettings settings : publisherSettings)
+    {
+      TraceSettings activeSettings = settings.classSettings;
+      Map<String, TraceSettings> methodSettings = settings.methodSettings;
+
+      if (shouldLog(activeSettings) || methodSettings != null)
+      {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
+   * Update the cached settings of the tracer with the settings from the
+   * provided publishers.
+   *
+   * @param publishers The array of publishers to obtain the settings from.
+   */
+  @SuppressWarnings({ "unchecked", "rawtypes" })
+  void updateSettings(DebugLogPublisher[] publishers)
+  {
+    PublisherSettings[] newSettings =
+        new PublisherSettings[publishers.length];
+
+    // Get the settings from all publishers.
+    for(int i = 0; i < publishers.length; i++)
+    {
+      DebugLogPublisher publisher = publishers[i];
+      PublisherSettings settings = new PublisherSettings();
+
+      settings.debugPublisher = publisher;
+      settings.classSettings = publisher.getClassSettings(className);
+
+      // For some reason, the compiler doesn't see that
+      // debugLogPublihser.getMethodSettings returns a parameterized Map.
+      // This problem goes away if a parameterized verson of DebugLogPublisher
+      // is used. However, we can't not use reflection to instantiate a generic
+      // DebugLogPublisher<? extends DebugLogPublisherCfg> type. The only thing
+      // we can do is to just supress the compiler warnings.
+      settings.methodSettings = publisher.getMethodSettings(className);
+
+      newSettings[i] = settings;
+    }
+
+    publisherSettings = newSettings;
+  }
+
+  /**
+   * Return the caller stack frame.
+   *
+   * @param stackTrace The entrie stack trace frames.
+   * @return the caller stack frame or null if none is found on the
+   * stack trace.
+   */
+  private StackTraceElement getCallerFrame(StackTraceElement[] stackTrace)
+  {
+    if (stackTrace != null && stackTrace.length > 0)
+    {
+      // Skip leading frames debug logging classes and getStackTrace
+      // method call frame if any.
+      for (StackTraceElement aStackTrace : stackTrace)
+      {
+        if(aStackTrace.getClassName().startsWith("java.lang.Thread"))
+        {
+          continue;
+        }
+
+        if (!aStackTrace.getClassName().startsWith(
+            "org.opends.server.loggers.debug"))
+        {
+          return aStackTrace;
+        }
+      }
+    }
+
+    return null;
+  }
+
+  private boolean shouldLog(LogCategory messageCategory, TraceSettings activeSettings)
+  {
+    return activeSettings.includeCategories != null &&
+        activeSettings.includeCategories.contains(messageCategory);
+  }
+
+  /** Indicates if at least one category is active for logging. */
+  private boolean shouldLog(TraceSettings settings)
+  {
+    return settings.includeCategories != null && !settings.includeCategories.isEmpty();
+  }
+}
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/EncryptAction.java b/opendj3-server-dev/src/server/org/opends/server/loggers/EncryptAction.java
index 7d40c9c..7b7f7c4 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/EncryptAction.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/EncryptAction.java
@@ -22,6 +22,7 @@
  *
  *
  *      Copyright 2006-2008 Sun Microsystems, Inc.
+ *      Portions Copyright 2014 ForgeRock AS
  */
 package org.opends.server.loggers;
 
@@ -31,7 +32,7 @@
  * This class implements a post rotation action that encrypts
  * the log file.
  */
-public class EncryptAction implements PostRotationAction
+class EncryptAction implements PostRotationAction
 {
 
   private File originalFile;
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/FileComparator.java b/opendj3-server-dev/src/server/org/opends/server/loggers/FileComparator.java
index 617af77..da2807b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/FileComparator.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/FileComparator.java
@@ -22,6 +22,7 @@
  *
  *
  *      Copyright 2006-2008 Sun Microsystems, Inc.
+ *      Portions Copyright 2014 ForgeRock AS
  */
 package org.opends.server.loggers;
 
@@ -35,7 +36,7 @@
  * This class implements a comparator that can compare two files based on the
  * time that they were last modified.
  */
-public class FileComparator implements Comparator<File>
+class FileComparator implements Comparator<File>
 {
   /**
    * Compare two files based on file modification time.
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/GZIPAction.java b/opendj3-server-dev/src/server/org/opends/server/loggers/GZIPAction.java
index 3ad057c..6f7ab92 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/GZIPAction.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/GZIPAction.java
@@ -38,7 +38,7 @@
  * This class implements a post rotation action that compresses
  * the file using GZIP compression.
  */
-public class GZIPAction implements PostRotationAction
+class GZIPAction implements PostRotationAction
 {
 
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/LogFileFilter.java b/opendj3-server-dev/src/server/org/opends/server/loggers/LogFileFilter.java
index dc3a093..84c5799 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/LogFileFilter.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/LogFileFilter.java
@@ -22,6 +22,7 @@
  *
  *
  *      Copyright 2006-2008 Sun Microsystems, Inc.
+ *      Portions Copyright 2014 ForgeRock AS
  */
 package org.opends.server.loggers;
 
@@ -32,7 +33,7 @@
 /**
  * This class defines a filename filter that will be used for log files.
  */
-public class LogFileFilter implements FilenameFilter
+class LogFileFilter implements FilenameFilter
 {
   private String prefix;
 
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/LogPublisherErrorHandler.java b/opendj3-server-dev/src/server/org/opends/server/loggers/LogPublisherErrorHandler.java
index 540f9ea..c5eb9d5 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/LogPublisherErrorHandler.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/LogPublisherErrorHandler.java
@@ -41,7 +41,7 @@
  * The advantage of using a handler is that we can handle exceptions
  * asynchronously (useful when dealing with an AsynchronousPublisher).
  */
-public class LogPublisherErrorHandler
+class LogPublisherErrorHandler
 {
   private DN publisherConfigDN;
   private boolean writeErroroccurred = false;
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/LoggerAlarmHandler.java b/opendj3-server-dev/src/server/org/opends/server/loggers/LoggerAlarmHandler.java
index 57cb199..887a73b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/LoggerAlarmHandler.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/LoggerAlarmHandler.java
@@ -22,6 +22,7 @@
  *
  *
  *      Copyright 2006-2008 Sun Microsystems, Inc.
+ *      Portions Copyright 2014 ForgeRock AS
  */
 package org.opends.server.loggers;
 
@@ -31,7 +32,7 @@
  * This interface describes the handler that is invoked when the logger
  * thread generates an alarm based on a rotation policy condition being met.
  */
-public interface LoggerAlarmHandler
+interface LoggerAlarmHandler
 {
 
   /**
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/LoggingCategoryNames.java b/opendj3-server-dev/src/server/org/opends/server/loggers/LoggingCategoryNames.java
new file mode 100644
index 0000000..6ffe24a
--- /dev/null
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/LoggingCategoryNames.java
@@ -0,0 +1,142 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2014 ForgeRock AS.
+ */
+package org.opends.server.loggers;
+
+import java.util.Map.Entry;
+import java.util.NavigableMap;
+import java.util.TreeMap;
+
+/**
+ * Provides mapping from class names to simple category names used for logging.
+ * <p>
+ * Given a classname, eg org.forgerock.opendj.server.core.SomeClass, it allows
+ * to get the corresponding simplified category name if it exists, eg "CORE". If
+ * no simplified category name exist, the classname is used as a category name.
+ */
+class LoggingCategoryNames
+{
+  /**
+   * Contains mapping from class names (or package names) to category names. In
+   * most case, package name is sufficient to map to a category name. It is
+   * valid if several entries point to the same category name.
+   */
+  private static final NavigableMap<String, String> NAMES =
+      new TreeMap<String, String>();
+
+  static
+  {
+    // The category used for messages associated with the core server.
+    NAMES.put("org.opends.server.core", "CORE");
+
+    // The category used for messages associated with server
+    //extensions (e.g., extended operations, SASL mechanisms, password storage
+    // schemes, password validators, etc.).
+    NAMES.put("org.opends.server.extensions", "EXTENSIONS");
+
+    // The category used for messages associated with
+    // connection and protocol handling (e.g., ASN.1 and LDAP).
+    NAMES.put("org.opends.server.protocol", "PROTOCOL");
+
+    // The category used for messages associated with
+    // configuration handling.
+    NAMES.put("org.opends.server.config", "CONFIG");
+
+    // The category used for messages associated with the
+    // server loggers.
+    NAMES.put("org.opends.server.loggers", "LOG");
+
+    // The category used for messages associated with the
+    // general server utilities.
+    NAMES.put("org.opends.server.util", "UTIL");
+
+    // The category used for messages associated with the
+    // server schema elements.
+    NAMES.put("org.opends.server.schema", "SCHEMA");
+
+    // The category that will be used for messages associated with plugin
+    // processing.
+    NAMES.put("org.opends.server.plugins", "PLUGIN");
+
+    // The category used for messages associated with the JE backend.
+    NAMES.put("org.opends.server.backends.jeb", "JEB");
+
+    // The category used for messages associated with generic backends.
+    NAMES.put("org.opends.server.backends", "BACKEND");
+
+    // The category used for messages associated with tools
+    NAMES.put("org.opends.server.tools", "TOOLS");
+
+    // The category used for messages associated with tasks
+    NAMES.put("org.opends.server.tasks", "TASK");
+
+    // The category used for messages associated with Access Control
+    NAMES.put("org.opends.server.authorization", "ACCESS_CONTROL");
+
+    // The category used for messages associated with the administration
+    // framework.
+    NAMES.put("org.opends.server.admin", "ADMIN");
+
+    // The category used for messages associated with the Synchronization
+    NAMES.put("org.opends.server.replication", "SYNC");
+
+    // The category used for messages associated with version information
+    //PACKAGES_TO_NAMES.put("org.opends.server", "VERSION");
+
+    // The category used for messages associated with quicksetup tools
+    NAMES.put("org.opends.quicksetup", "QUICKSETUP");
+
+    // The category used for messages associated with the tool like the offline
+    // installer and unintaller.
+    NAMES.put("org.opends.quicksetup.offline", "ADMIN_TOOL");
+    NAMES.put("org.opends.guitools.uninstaller", "ADMIN_TOOL");
+
+    // The category used for messages associated with the dsconfig
+    // administration tool.
+    NAMES.put("org.opends.admin.ads", "DSCONFIG");
+
+    // The category used for messages associated with the runtime information
+    //NAMES.put("org.opends.server", "RUNTIME_INFORMATION");
+  }
+
+  /**
+   * Returns the simple category name corresponding to the provided class name
+   * or the class name if no mapping corresponds.
+   *
+   * @param className
+   *          The classname to retrieve the category name from.
+   * @return the simple category name, or the provided className if no matching
+   *         simple category name is found
+   */
+  static String getCategoryName(final String className)
+  {
+    final Entry<String, String> entry = NAMES.floorEntry(className);
+    if (entry != null && className.startsWith(entry.getKey()))
+    {
+      return entry.getValue();
+    }
+    return className;
+  }
+}
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/MultifileTextWriter.java b/opendj3-server-dev/src/server/org/opends/server/loggers/MultifileTextWriter.java
index ac29e09..c63b438 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/MultifileTextWriter.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/MultifileTextWriter.java
@@ -57,7 +57,7 @@
  * When a switch is required, the writer closes the current file and opens a
  * new one named in accordance with a specified FileNamingPolicy.
  */
-public class MultifileTextWriter
+class MultifileTextWriter
     implements ServerShutdownListener, TextWriter,
     ConfigurationChangeListener<SizeLimitLogRotationPolicyCfg>
 {
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/ParallelTextWriter.java b/opendj3-server-dev/src/server/org/opends/server/loggers/ParallelTextWriter.java
index 114e642..68816f5 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/ParallelTextWriter.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/ParallelTextWriter.java
@@ -45,7 +45,7 @@
  * character-based stream. Note that this implementation is
  * parallel unbound ie there is no queue size cap imposed.
  */
-public class ParallelTextWriter
+class ParallelTextWriter
     implements ServerShutdownListener, TextWriter
 {
   /**
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/PostRotationAction.java b/opendj3-server-dev/src/server/org/opends/server/loggers/PostRotationAction.java
index bb454bb..e1f2c5f 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/PostRotationAction.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/PostRotationAction.java
@@ -22,6 +22,7 @@
  *
  *
  *      Copyright 2006-2008 Sun Microsystems, Inc.
+ *      Portions Copyright 2014 ForgeRock AS
  */
 package org.opends.server.loggers;
 
@@ -31,7 +32,7 @@
  * This interface describes the action that needs to be taken
  * at the time of a rotation.
  */
-public interface PostRotationAction
+interface PostRotationAction
 {
   /**
    * The action that needs to be executed. Returns true
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/debug/TextDebugLogPublisher.java b/opendj3-server-dev/src/server/org/opends/server/loggers/TextDebugLogPublisher.java
similarity index 92%
rename from opendj3-server-dev/src/server/org/opends/server/loggers/debug/TextDebugLogPublisher.java
rename to opendj3-server-dev/src/server/org/opends/server/loggers/TextDebugLogPublisher.java
index f254b82..278ffd5 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/debug/TextDebugLogPublisher.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/TextDebugLogPublisher.java
@@ -24,7 +24,7 @@
  *      Copyright 2006-2009 Sun Microsystems, Inc.
  *      Portions Copyright 2013-2014 ForgeRock AS
  */
-package org.opends.server.loggers.debug;
+package org.opends.server.loggers;
 
 import java.io.File;
 import java.io.IOException;
@@ -42,7 +42,6 @@
 import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.ServerContext;
-import org.opends.server.loggers.*;
 import org.opends.server.types.*;
 import org.opends.server.util.TimeThread;
 
@@ -450,50 +449,35 @@
    * {@inheritDoc}
    */
   @Override
-  public void traceMessage(TraceSettings settings,
-                           String signature,
-                           String sourceLocation,
-                           String msg,
-                           StackTraceElement[] stackTrace)
+  public void trace(TraceSettings settings, String signature,
+      String sourceLocation, String msg, StackTraceElement[] stackTrace)
   {
-    LogCategory category = DebugLogCategory.MESSAGE;
-
     String stack = null;
-    if(stackTrace != null)
+    if (stackTrace != null)
     {
       stack = DebugStackTraceFormatter.formatStackTrace(stackTrace,
-                                                        settings.stackDepth);
+          settings.stackDepth);
     }
-    publish(category, signature, sourceLocation, msg, stack);
+    publish(DebugLogCategory.MESSAGE, signature, sourceLocation, msg, stack);
   }
 
   /**
    * {@inheritDoc}
    */
   @Override
-  public void traceCaught(TraceSettings settings,
-                          String signature,
-                          String sourceLocation,
-                          String msg,
-                          Throwable ex, StackTraceElement[] stackTrace)
+  public void traceException(TraceSettings settings, String signature,
+      String sourceLocation, String msg, Throwable ex,
+      StackTraceElement[] stackTrace)
   {
-    LogCategory category = DebugLogCategory.CAUGHT;
-    StringBuilder message = new StringBuilder();
-    if (!msg.isEmpty())
-    {
-      message.append(msg).append(" ");
-    }
-    message.append(DebugMessageFormatter.format("caught={%s}",
-        new Object[] { ex }));
+    String message = DebugMessageFormatter.format("%s caught={%s}", new Object[] { msg, ex });
 
     String stack = null;
-    if(stackTrace != null)
+    if (stackTrace != null)
     {
-      stack = DebugStackTraceFormatter.formatStackTrace(ex,
-                                                        settings.stackDepth,
-                                                        settings.includeCause);
+      stack = DebugStackTraceFormatter.formatStackTrace(ex, settings.stackDepth,
+          settings.includeCause);
     }
-    publish(category, signature, sourceLocation, message.toString(), stack);
+    publish(DebugLogCategory.CAUGHT, signature, sourceLocation, message, stack);
   }
 
   /**
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/debug/TraceSettings.java b/opendj3-server-dev/src/server/org/opends/server/loggers/TraceSettings.java
similarity index 98%
rename from opendj3-server-dev/src/server/org/opends/server/loggers/debug/TraceSettings.java
rename to opendj3-server-dev/src/server/org/opends/server/loggers/TraceSettings.java
index 5b3ac7d..5a60900 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/debug/TraceSettings.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/TraceSettings.java
@@ -25,20 +25,16 @@
  *      Portions Copyright 2014 ForgeRock AS
  */
 
-package org.opends.server.loggers.debug;
+package org.opends.server.loggers;
 import org.forgerock.i18n.LocalizableMessage;
-
 import org.opends.server.types.DebugLogLevel;
 import org.opends.server.types.DebugLogCategory;
 import org.opends.server.types.ConfigChangeResult;
 import org.opends.server.types.ResultCode;
-import org.opends.server.loggers.LogLevel;
-import org.opends.server.loggers.LogCategory;
 import org.opends.server.admin.server.ConfigurationChangeListener;
 import org.opends.server.admin.std.meta.DebugTargetCfgDefn;
 import org.opends.server.admin.std.server.DebugTargetCfg;
 
-
 import java.util.*;
 
 /**
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/debug/DebugTracer.java b/opendj3-server-dev/src/server/org/opends/server/loggers/debug/DebugTracer.java
deleted file mode 100644
index e17931b..0000000
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/debug/DebugTracer.java
+++ /dev/null
@@ -1,512 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2006-2009 Sun Microsystems, Inc.
- *      Portions Copyright 2014 ForgeRock AS
- */
-package org.opends.server.loggers.debug;
-
-import org.opends.server.api.DebugLogPublisher;
-import org.opends.server.types.DebugLogCategory;
-import org.opends.server.types.DebugLogLevel;
-import org.opends.server.loggers.LogLevel;
-import org.opends.server.loggers.LogCategory;
-
-import java.util.Map;
-
-/**
- * Class for source-code tracing at the method level.
- *
- * One DebugTracer instance exists for each Java class using tracing.
- * Tracer must be registered with the DebugLogger.
- *
- * Logging is always done at a level basis, with debug log messages
- * exceeding the trace threshold being traced, others being discarded.
- */
-
-public class DebugTracer
-{
-  /** The class this aspect traces. */
-  private String className;
-
-  /**
-   * A class that represents a settings cache entry.
-   */
-  private class PublisherSettings
-  {
-    DebugLogPublisher debugPublisher;
-    TraceSettings classSettings;
-    Map<String, TraceSettings> methodSettings;
-  }
-
-  private PublisherSettings[] publisherSettings;
-
-  /**
-   * Construct a new DebugTracer object with cached settings obtained from
-   * the provided array of publishers.
-   *
-   * @param className The classname to use as category for logging.
-   * @param publishers The array of publishers to obtain the settings from.
-   */
-  @SuppressWarnings({ "unchecked", "rawtypes" })
-  DebugTracer(String className, DebugLogPublisher[] publishers)
-  {
-    this.className = className;
-    publisherSettings = new PublisherSettings[publishers.length];
-
-    // Get the settings from all publishers.
-    for(int i = 0; i < publishers.length; i++)
-    {
-      DebugLogPublisher publisher = publishers[i];
-      PublisherSettings settings = new PublisherSettings();
-
-      settings.debugPublisher = publisher;
-      settings.classSettings = publisher.getClassSettings(className);
-
-      // For some reason, the compiler doesn't see that
-      // debugLogPublihser.getMethodSettings returns a parameterized Map.
-      // This problem goes away if a parameterized verson of DebugLogPublisher
-      // is used. However, we can't not use reflection to instantiate a generic
-      // DebugLogPublisher<? extends DebugLogPublisherCfg> type. The only thing
-      // we can do is to just supress the compiler warnings.
-      settings.methodSettings = publisher.getMethodSettings(className);
-
-      publisherSettings[i] = settings;
-    }
-  }
-
-  /**
-   * Log an arbitrary event at the verbose level.
-   * Same as debugMessage(DebugLogLevel.ERROR, msg)
-   *
-   * @param msg message to format and log.
-   */
-  public void debugVerbose(String msg)
-  {
-    debugMessage(DebugLogLevel.VERBOSE, msg, new Object[]{});
-  }
-
-  /**
-   * Log an arbitrary event at the verbose level.
-   * Same as debugMessage(DebugLogLevel.ERROR, msg, msgArgs...)
-   *
-   * @param msg message to format and log.
-   * @param msgArgs arguments to place into the format string.
-   */
-  public void debugVerbose(String msg, Object... msgArgs)
-  {
-    debugMessage(DebugLogLevel.VERBOSE, msg, msgArgs);
-  }
-
-  /**
-   * Log an arbitrary event at the info level.
-   * Same as debugMessage(DebugLogLevel.ERROR, msg)
-   *
-   * @param msg message to format and log.
-   */
-  public void debugInfo(String msg)
-  {
-    debugMessage(DebugLogLevel.INFO, msg, new Object[]{});
-  }
-
-  /**
-   * Log an arbitrary event at the info level.
-   * Same as debugMessage(DebugLogLevel.ERROR, msg, msgArgs...)
-   *
-   * @param msg message to format and log.
-   * @param msgArgs arguments to place into the format string.
-   */
-  public void debugInfo(String msg, Object... msgArgs)
-  {
-    debugMessage(DebugLogLevel.INFO, msg, msgArgs);
-  }
-
-  /**
-   * Log an arbitrary event at the warning level.
-   * Same as debugMessage(DebugLogLevel.ERROR, msg)
-   *
-   * @param msg message to format and log.
-   */
-  public void debugWarning(String msg)
-
-  {
-    debugMessage(DebugLogLevel.WARNING, msg, new Object[]{});
-  }
-
-  /**
-   * Log an arbitrary event at the warning level.
-   * Same as debugMessage(DebugLogLevel.ERROR, msg, msgArgs...)
-   *
-   * @param msg message to format and log.
-   * @param msgArgs arguments to place into the format string.
-   */
-  public void debugWarning(String msg, Object... msgArgs)
-  {
-    debugMessage(DebugLogLevel.WARNING, msg, msgArgs);
-  }
-
-  /**
-   * Log an arbitrary event at the error level.
-   * Same as debugMessage(DebugLogLevel.ERROR, msg)
-   *
-   * @param msg message to format and log.
-   */
-  public void debugError(String msg)
-
-  {
-    debugMessage(DebugLogLevel.ERROR, msg, new Object[]{});
-  }
-
-  /**
-   * Log an arbitrary event at the error level.
-   * Same as debugMessage(DebugLogLevel.ERROR, msg, msgArgs...)
-   *
-   * @param msg message to format and log.
-   * @param msgArgs arguments to place into the format string.
-   */
-  public void debugError(String msg, Object... msgArgs)
-  {
-    debugMessage(DebugLogLevel.ERROR, msg, msgArgs);
-  }
-
-  /**
-   * Log an arbitrary event.
-   *
-   * @param level the level of the log message.
-   * @param msg message to format and log.
-   */
-  public void debugMessage(LogLevel level, String msg)
-  {
-    debugMessage(level, msg, new Object[]{});
-  }
-
-  /**
-   * Log an arbitrary event.
-   *
-   * @param level the level of the log message.
-   * @param msg message to format and log.
-   * @param msgArgs arguments to place into the format string.
-   */
-  public void debugMessage(LogLevel level, String msg, Object... msgArgs)
-  {
-    if(DebugLogger.debugEnabled())
-    {
-      StackTraceElement[] stackTrace = null;
-      StackTraceElement[] filteredStackTrace = null;
-      StackTraceElement callerFrame = null;
-      for (PublisherSettings settings : publisherSettings)
-      {
-        TraceSettings activeSettings = settings.classSettings;
-        Map<String, TraceSettings> methodSettings = settings.methodSettings;
-
-        if (shouldLog(DebugLogCategory.MESSAGE, activeSettings) || methodSettings != null)
-        {
-          if(stackTrace == null)
-          {
-            stackTrace = Thread.currentThread().getStackTrace();
-          }
-          if (callerFrame == null)
-          {
-            callerFrame = getCallerFrame(stackTrace);
-          }
-
-          String signature = callerFrame.getMethodName();
-
-          // Specific method settings still could exist. Try getting
-          // the settings for this method.
-          if(methodSettings != null)
-          {
-            TraceSettings mSettings = methodSettings.get(signature);
-
-            if (mSettings == null)
-            {
-              // Try looking for an undecorated method name
-              int idx = signature.indexOf('(');
-              if (idx != -1)
-              {
-                mSettings =
-                    methodSettings.get(signature.substring(0, idx));
-              }
-            }
-
-            // If this method does have a specific setting and it is not
-            // suppose to be logged, continue.
-            if (mSettings != null)
-            {
-              if(!shouldLog(DebugLogCategory.MESSAGE, mSettings))
-              {
-                continue;
-              }
-              else
-              {
-                activeSettings = mSettings;
-              }
-            }
-          }
-
-          String sl = callerFrame.getFileName() + ":" +
-              callerFrame.getLineNumber();
-
-          if(msgArgs != null && msgArgs.length > 0)
-          {
-            msg = String.format(msg, msgArgs);
-          }
-
-          if (filteredStackTrace == null && activeSettings.stackDepth > 0)
-          {
-            filteredStackTrace =
-                DebugStackTraceFormatter.SMART_FRAME_FILTER.
-                    getFilteredStackTrace(stackTrace);
-          }
-
-          settings.debugPublisher.traceMessage(activeSettings, signature, sl,
-                                               msg, filteredStackTrace);
-        }
-      }
-    }
-  }
-
-  /**
-   * Log a caught exception.
-   *
-   * @param level the level of the log message.
-   * @param ex the exception caught.
-   */
-  public void debugCaught(LogLevel level, Throwable ex)
-  {
-    debugCaught("", ex);
-  }
-
-  /**
-   * Log a caught exception.
-   *
-   * @param msg the message
-   * @param ex the exception caught.
-   */
-  public void debugCaught(String msg, Throwable ex)
-  {
-    if(DebugLogger.debugEnabled())
-    {
-      StackTraceElement[] stackTrace = null;
-      StackTraceElement[] filteredStackTrace = null;
-      StackTraceElement callerFrame = null;
-      for (PublisherSettings settings : publisherSettings)
-      {
-        TraceSettings activeSettings = settings.classSettings;
-        Map<String, TraceSettings> methodSettings = settings.methodSettings;
-
-        if (shouldLog(DebugLogCategory.CAUGHT, activeSettings) || methodSettings != null)
-        {
-          if(stackTrace == null)
-          {
-            stackTrace = Thread.currentThread().getStackTrace();
-          }
-          if (callerFrame == null)
-          {
-            callerFrame = getCallerFrame(stackTrace);
-          }
-
-          String signature = callerFrame.getMethodName();
-
-          // Specific method settings still could exist. Try getting
-          // the settings for this method.
-          if(methodSettings != null)
-          {
-            TraceSettings mSettings = methodSettings.get(signature);
-
-            if (mSettings == null)
-            {
-              // Try looking for an undecorated method name
-              int idx = signature.indexOf('(');
-              if (idx != -1)
-              {
-                mSettings =
-                    methodSettings.get(signature.substring(0, idx));
-              }
-            }
-
-            // If this method does have a specific setting and it is not
-            // suppose to be logged, continue.
-            if (mSettings != null)
-            {
-              if(!shouldLog(DebugLogCategory.CAUGHT, mSettings))
-              {
-                continue;
-              }
-              else
-              {
-                activeSettings = mSettings;
-              }
-            }
-          }
-
-          String sl = callerFrame.getFileName() + ":" +
-              callerFrame.getLineNumber();
-
-          if (filteredStackTrace == null && activeSettings.stackDepth > 0)
-          {
-            filteredStackTrace =
-                DebugStackTraceFormatter.SMART_FRAME_FILTER.
-                    getFilteredStackTrace(ex.getStackTrace());
-          }
-
-          settings.debugPublisher.traceCaught(activeSettings, signature, sl,
-                                              msg, ex, filteredStackTrace);
-        }
-      }
-    }
-  }
-
-  /**
-   * Gets the name of the class this tracer traces.
-   *
-   * @return The name of the class this tracer traces.
-   */
-  public String getTracedClassName()
-  {
-    return className;
-  }
-
-  /**
-   * Indicates if logging is enabled for the provided debug log
-   * category.
-   *
-   * @param logCategory
-   *            Log category to check
-   * @return {@code true} if logging is enabled, false otherwise.
-   */
-  public boolean enabledFor(LogCategory logCategory)
-  {
-    for (PublisherSettings settings : publisherSettings)
-    {
-      TraceSettings activeSettings = settings.classSettings;
-      Map<String, TraceSettings> methodSettings = settings.methodSettings;
-
-      if (shouldLog(logCategory, activeSettings)
-          || methodSettings != null)
-      {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  /**
-   * Indicates if logging is enabled for at least one category
-   * in a publisher.
-   *
-   * @return {@code true} if logging is enabled, false otherwise.
-   */
-  public boolean enabled()
-  {
-    for (PublisherSettings settings : publisherSettings)
-    {
-      TraceSettings activeSettings = settings.classSettings;
-      Map<String, TraceSettings> methodSettings = settings.methodSettings;
-
-      if (shouldLog(activeSettings) || methodSettings != null)
-      {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  /**
-   * Update the cached settings of the tracer with the settings from the
-   * provided publishers.
-   *
-   * @param publishers The array of publishers to obtain the settings from.
-   */
-  @SuppressWarnings({ "unchecked", "rawtypes" })
-  void updateSettings(DebugLogPublisher[] publishers)
-  {
-    PublisherSettings[] newSettings =
-        new PublisherSettings[publishers.length];
-
-    // Get the settings from all publishers.
-    for(int i = 0; i < publishers.length; i++)
-    {
-      DebugLogPublisher publisher = publishers[i];
-      PublisherSettings settings = new PublisherSettings();
-
-      settings.debugPublisher = publisher;
-      settings.classSettings = publisher.getClassSettings(className);
-
-      // For some reason, the compiler doesn't see that
-      // debugLogPublihser.getMethodSettings returns a parameterized Map.
-      // This problem goes away if a parameterized verson of DebugLogPublisher
-      // is used. However, we can't not use reflection to instantiate a generic
-      // DebugLogPublisher<? extends DebugLogPublisherCfg> type. The only thing
-      // we can do is to just supress the compiler warnings.
-      settings.methodSettings = publisher.getMethodSettings(className);
-
-      newSettings[i] = settings;
-    }
-
-    publisherSettings = newSettings;
-  }
-
-  /**
-   * Return the caller stack frame.
-   *
-   * @param stackTrace The entrie stack trace frames.
-   * @return the caller stack frame or null if none is found on the
-   * stack trace.
-   */
-  private StackTraceElement getCallerFrame(StackTraceElement[] stackTrace)
-  {
-    if (stackTrace != null && stackTrace.length > 0)
-    {
-      // Skip leading frames debug logging classes and getStackTrace
-      // method call frame if any.
-      for (StackTraceElement aStackTrace : stackTrace)
-      {
-        if(aStackTrace.getClassName().startsWith("java.lang.Thread"))
-        {
-          continue;
-        }
-
-        if (!aStackTrace.getClassName().startsWith(
-            "org.opends.server.loggers.debug"))
-        {
-          return aStackTrace;
-        }
-      }
-    }
-
-    return null;
-  }
-
-  private boolean shouldLog(LogCategory messageCategory, TraceSettings activeSettings)
-  {
-    return activeSettings.includeCategories != null &&
-        activeSettings.includeCategories.contains(messageCategory);
-  }
-
-  /** Indicates if at least one category is active for logging. */
-  private boolean shouldLog(TraceSettings settings)
-  {
-    return settings.includeCategories != null && !settings.includeCategories.isEmpty();
-  }
-}
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/debug/package-info.java b/opendj3-server-dev/src/server/org/opends/server/loggers/debug/package-info.java
deleted file mode 100644
index e8778ce..0000000
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/debug/package-info.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2006-2008 Sun Microsystems, Inc.
- */
-
-
-
-/**
- * Contains implementation of the debug logger for the Directory Server.
- * Static methods are included in the DebugLogger class to log a debug message.
- * The debug logging framework uses AspectJ AOP to crosscut certain logging
- * concerns across server code base at weave time during the build process. If
- * the weaving step is skipped, the debug logging framework is disabled.
- * The AspectJ aspect defined in the Tracer class is used to automatically trace
- * method entry and exit events and generate the appropriate debug messages. It
- * also keeps track of the source location of debug message calls so information
- * about the class, method, line number, and threads are automatically included
- * in the debug message.
- */
-@org.opends.server.types.PublicAPI(
-     stability=org.opends.server.types.StabilityLevel.PRIVATE)
-package org.opends.server.loggers.debug;
-
diff --git a/opendj3-server-dev/src/server/org/opends/server/loggers/package-info.java b/opendj3-server-dev/src/server/org/opends/server/loggers/package-info.java
index d81d29b..9c3f259 100644
--- a/opendj3-server-dev/src/server/org/opends/server/loggers/package-info.java
+++ b/opendj3-server-dev/src/server/org/opends/server/loggers/package-info.java
@@ -22,13 +22,12 @@
  *
  *
  *      Copyright 2006-2008 Sun Microsystems, Inc.
+ *      Portions Copyright 2014 ForgeRock AS
  */
 
-
-
 /**
  * Contains implementations of Directory Server access, error, and debug
- * loggers.  This includes classes with static methods that should be used to
+ * loggers.  This includes classes with static methods are used to
  * trigger the generation of log messages, as well as actual implementations
  * that can write the log contents to various targets.
  */
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/BackUpDB.java b/opendj3-server-dev/src/server/org/opends/server/tools/BackUpDB.java
index ed36fb5..2eeea03 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/BackUpDB.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/BackUpDB.java
@@ -27,7 +27,9 @@
 package org.opends.server.tools;
 
 import java.io.File;
+
 import org.forgerock.i18n.slf4j.LocalizedLogger;
+
 import java.io.OutputStream;
 import java.io.PrintStream;
 import java.text.SimpleDateFormat;
@@ -48,11 +50,11 @@
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.LockFileManager;
 import org.opends.server.extensions.ConfigFileHandler;
+import org.opends.server.loggers.DebugLogger;
 import org.opends.server.loggers.ErrorLogger;
+import org.opends.server.loggers.TextDebugLogPublisher;
 import org.opends.server.loggers.TextErrorLogPublisher;
 import org.opends.server.loggers.TextWriter;
-import org.opends.server.loggers.debug.DebugLogger;
-import org.opends.server.loggers.debug.TextDebugLogPublisher;
 import org.opends.server.protocols.ldap.LDAPAttribute;
 import org.opends.server.tasks.BackupTask;
 import org.opends.server.tools.tasks.TaskTool;
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/ConsoleDebugLogPublisher.java b/opendj3-server-dev/src/server/org/opends/server/tools/ConsoleDebugLogPublisher.java
index 059fb78..37a8a39 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/ConsoleDebugLogPublisher.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/ConsoleDebugLogPublisher.java
@@ -34,10 +34,10 @@
 import org.opends.server.api.DebugLogPublisher;
 import org.opends.server.config.ConfigException;
 import org.opends.server.core.ServerContext;
+import org.opends.server.loggers.DebugMessageFormatter;
+import org.opends.server.loggers.DebugStackTraceFormatter;
 import org.opends.server.loggers.LogCategory;
-import org.opends.server.loggers.debug.DebugMessageFormatter;
-import org.opends.server.loggers.debug.DebugStackTraceFormatter;
-import org.opends.server.loggers.debug.TraceSettings;
+import org.opends.server.loggers.TraceSettings;
 import org.opends.server.types.DN;
 import org.opends.server.types.DebugLogCategory;
 import org.opends.server.types.InitializationException;
@@ -83,7 +83,7 @@
    * {@inheritDoc}
    */
   @Override
-  public void traceMessage(TraceSettings settings,
+  public void trace(TraceSettings settings,
                            String signature,
                            String sourceLocation,
                            String msg,
@@ -94,8 +94,7 @@
     String stack = null;
     if(stackTrace != null)
     {
-      stack = DebugStackTraceFormatter.formatStackTrace(stackTrace,
-                                                      settings.getStackDepth());
+      stack = DebugStackTraceFormatter.formatStackTrace(stackTrace, settings.getStackDepth());
     }
     publish(category, msg, stack);
   }
@@ -104,7 +103,7 @@
    * {@inheritDoc}
    */
   @Override
-  public void traceCaught(TraceSettings settings,
+  public void traceException(TraceSettings settings,
                           String signature,
                           String sourceLocation,
                           String msg,
@@ -112,18 +111,8 @@
   {
     LogCategory category = DebugLogCategory.CAUGHT;
 
-    StringBuilder format = new StringBuilder();
-    format.append("caught={%s} ");
-    format.append(signature);
-    format.append("():");
-    format.append(sourceLocation);
-    StringBuilder message = new StringBuilder();
-    if (!msg.isEmpty())
-    {
-      message.append(msg).append(" ");
-    }
-    message.append(DebugMessageFormatter.format("caught={%s}",
-        new Object[] { ex }));
+    String message = DebugMessageFormatter.format("%s caught={%s} %s(): %s",
+        new Object[] { msg, ex, signature, sourceLocation });
 
     String stack = null;
     if (stackTrace != null)
@@ -132,7 +121,7 @@
           DebugStackTraceFormatter.formatStackTrace(ex, settings
               .getStackDepth(), settings.isIncludeCause());
     }
-    publish(category, message.toString(), stack);
+    publish(category, message, stack);
   }
 
   /**
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/ExportLDIF.java b/opendj3-server-dev/src/server/org/opends/server/tools/ExportLDIF.java
index 1f49f5c..8874801 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/ExportLDIF.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/ExportLDIF.java
@@ -27,7 +27,9 @@
 package org.opends.server.tools;
 
 import java.io.OutputStream;
+
 import org.forgerock.i18n.slf4j.LocalizedLogger;
+
 import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -38,16 +40,18 @@
 import org.opends.server.api.DebugLogPublisher;
 import org.opends.server.api.plugin.PluginType;
 import org.opends.server.config.ConfigException;
+
 import static org.opends.server.config.ConfigConstants.*;
+
 import org.opends.server.core.CoreConfigManager;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.LockFileManager;
 import org.opends.server.extensions.ConfigFileHandler;
+import org.opends.server.loggers.DebugLogger;
+import org.opends.server.loggers.TextDebugLogPublisher;
 import org.opends.server.loggers.TextWriter;
 import org.opends.server.loggers.TextErrorLogPublisher;
 import org.opends.server.loggers.ErrorLogger;
-import org.opends.server.loggers.debug.TextDebugLogPublisher;
-import org.opends.server.loggers.debug.DebugLogger;
 import org.opends.server.types.*;
 import org.forgerock.opendj.ldap.ByteString;
 import org.opends.server.util.BuildVersion;
@@ -57,12 +61,13 @@
 import org.opends.server.util.args.StringArgument;
 import org.opends.server.util.args.LDAPConnectionArgumentParser;
 import org.opends.server.util.cli.CLIException;
-
 import org.forgerock.i18n.LocalizableMessage;
+
 import static org.opends.messages.ToolMessages.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
 import static org.opends.server.tools.ToolConstants.*;
+
 import org.opends.server.tools.tasks.TaskTool;
 import org.opends.server.admin.std.server.BackendCfg;
 import org.opends.server.protocols.ldap.LDAPAttribute;
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/LDAPConnection.java b/opendj3-server-dev/src/server/org/opends/server/tools/LDAPConnection.java
index 81354aa..3e7a9c6 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/LDAPConnection.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/LDAPConnection.java
@@ -41,9 +41,9 @@
 import org.opends.server.controls.PasswordPolicyErrorType;
 import org.opends.server.controls.PasswordPolicyResponseControl;
 import org.opends.server.controls.PasswordPolicyWarningType;
-import org.opends.server.loggers.debug.DebugLogger;
+import org.opends.server.loggers.DebugLogger;
+import org.opends.server.loggers.TraceSettings;
 import org.forgerock.i18n.slf4j.LocalizedLogger;
-import org.opends.server.loggers.debug.TraceSettings;
 import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp;
 import org.opends.server.protocols.ldap.ExtendedResponseProtocolOp;
 import org.opends.server.protocols.ldap.LDAPControl;
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/RebuildIndex.java b/opendj3-server-dev/src/server/org/opends/server/tools/RebuildIndex.java
index 4a74114..e3a4467 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/RebuildIndex.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/RebuildIndex.java
@@ -41,16 +41,13 @@
 import org.opends.server.util.args.LDAPConnectionArgumentParser;
 import org.opends.server.util.args.StringArgument;
 import org.opends.server.extensions.ConfigFileHandler;
-
 import org.opends.server.config.ConfigException;
-
+import org.opends.server.loggers.DebugLogger;
+import org.opends.server.loggers.TextDebugLogPublisher;
 import org.opends.server.loggers.TextWriter;
 import org.opends.server.loggers.ErrorLogger;
 import org.opends.server.loggers.TextErrorLogPublisher;
-import org.opends.server.loggers.debug.TextDebugLogPublisher;
-import org.opends.server.loggers.debug.DebugLogger;
 import org.opends.server.protocols.ldap.LDAPAttribute;
-
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.CoreConfigManager;
 import org.opends.server.core.LockFileManager;
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/RestoreDB.java b/opendj3-server-dev/src/server/org/opends/server/tools/RestoreDB.java
index 7941e85..e3a5c7a 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/RestoreDB.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/RestoreDB.java
@@ -30,6 +30,7 @@
 
 
 
+
 import java.io.OutputStream;
 import java.io.PrintStream;
 import java.text.DateFormat;
@@ -43,16 +44,18 @@
 import org.opends.server.api.ErrorLogPublisher;
 import org.opends.server.api.DebugLogPublisher;
 import org.opends.server.config.ConfigException;
+
 import static org.opends.server.config.ConfigConstants.*;
+
 import org.opends.server.core.CoreConfigManager;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.LockFileManager;
 import org.opends.server.extensions.ConfigFileHandler;
+import org.opends.server.loggers.DebugLogger;
+import org.opends.server.loggers.TextDebugLogPublisher;
 import org.opends.server.loggers.TextWriter;
 import org.opends.server.loggers.ErrorLogger;
 import org.opends.server.loggers.TextErrorLogPublisher;
-import org.opends.server.loggers.debug.TextDebugLogPublisher;
-import org.opends.server.loggers.debug.DebugLogger;
 import org.opends.server.types.*;
 import org.forgerock.opendj.ldap.ByteString;
 import org.opends.server.util.BuildVersion;
@@ -66,6 +69,7 @@
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
 import static org.opends.server.tools.ToolConstants.*;
+
 import org.opends.server.tools.tasks.TaskTool;
 import org.opends.server.admin.std.server.BackendCfg;
 import org.opends.server.protocols.ldap.LDAPAttribute;
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/VerifyIndex.java b/opendj3-server-dev/src/server/org/opends/server/tools/VerifyIndex.java
index 82bf1c2..8607509 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/VerifyIndex.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/VerifyIndex.java
@@ -39,12 +39,12 @@
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.LockFileManager;
 import org.opends.server.extensions.ConfigFileHandler;
+import org.opends.server.loggers.DebugLogger;
+import org.opends.server.loggers.TextDebugLogPublisher;
 import org.opends.server.loggers.TextWriter;
 import org.opends.server.loggers.ErrorLogger;
 import org.opends.server.loggers.TextErrorLogPublisher;
-import org.opends.server.loggers.debug.TextDebugLogPublisher;
-import org.opends.server.loggers.debug.DebugLogger;
-import org.opends.server.loggers.debug.TraceSettings;
+import org.opends.server.loggers.TraceSettings;
 import org.opends.server.types.*;
 import org.opends.server.util.BuildVersion;
 import org.opends.server.util.args.ArgumentException;
@@ -64,6 +64,7 @@
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
 import static org.opends.server.tools.ToolConstants.*;
+
 import org.opends.server.admin.std.server.BackendCfg;
 
 
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
index 9c9b1c1..19c86a1 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -51,8 +51,6 @@
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.extensions.ConfigFileHandler;
 import org.opends.server.loggers.*;
-import org.opends.server.loggers.debug.DebugLogger;
-import org.opends.server.loggers.debug.TextDebugLogPublisher;
 import org.opends.server.plugins.InvocationCounterPlugin;
 import org.opends.server.protocols.asn1.ASN1;
 import org.opends.server.protocols.asn1.ASN1Reader;
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/loggers/LoggingCategoryNamesTest.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/loggers/LoggingCategoryNamesTest.java
new file mode 100644
index 0000000..6e7b237
--- /dev/null
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/loggers/LoggingCategoryNamesTest.java
@@ -0,0 +1,76 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2014 ForgeRock AS.
+ */
+package org.opends.server.loggers;
+
+import org.opends.server.DirectoryServerTestCase;
+import org.opends.server.core.DirectoryServer;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.*;
+
+@SuppressWarnings("javadoc")
+public class LoggingCategoryNamesTest extends DirectoryServerTestCase
+{
+  private final static String CORE_PACKAGE = DirectoryServer.class.getPackage().getName();
+  private final static String CORE_PACKAGE_NAME = "CORE";
+
+  @DataProvider
+  public Object[][] matchingNames()
+  {
+    return new Object[][] {
+      { CORE_PACKAGE },
+      { CORE_PACKAGE + ".SomeClass" },
+      { CORE_PACKAGE + ".pack1.SomeClass"},
+      { CORE_PACKAGE + ".pack1.pack2.SomeClass" },
+    };
+  }
+
+  @DataProvider
+  public Object[][] nonMatchingNames()
+  {
+    return new Object[][] {
+      { CORE_PACKAGE.substring(0, CORE_PACKAGE.length()-1) },
+      { CORE_PACKAGE.substring(0, CORE_PACKAGE.length()-1) + ".SomeClass" },
+      { CORE_PACKAGE.substring(0, CORE_PACKAGE.length()-1) + ".pack1.SomeClass"},
+      { "org.opends.server" },
+      { "" },
+      { "anyvalue" },
+    };
+  }
+
+  @Test(dataProvider = "matchingNames")
+  public void testMatching(String classname) throws Exception
+  {
+    assertEquals(LoggingCategoryNames.getCategoryName(classname), CORE_PACKAGE_NAME);
+  }
+
+  @Test(dataProvider = "nonMatchingNames")
+  public void testNonMatching(String classname) throws Exception
+  {
+    assertEquals(LoggingCategoryNames.getCategoryName(classname), classname);
+  }
+}
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/tasks/TestBackupAndRestore.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/tasks/TestBackupAndRestore.java
index 464e482..5d54d39 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/tasks/TestBackupAndRestore.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/tasks/TestBackupAndRestore.java
@@ -22,6 +22,7 @@
  *
  *
  *      Copyright 2006-2008 Sun Microsystems, Inc.
+ *      Portions Copyright 2014 ForgeRock AS.
  */
 
 
@@ -236,7 +237,7 @@
    * @param taskEntry The task entry.
    * @param expectedState The expected completion state of the task.
    */
-  @Test(dataProvider = "backups")
+  @Test(enabled=false, dataProvider = "backups")
   public void testBackups(Entry taskEntry, TaskState expectedState)
        throws Exception
   {

--
Gitblit v1.10.0