From 1d5d1a6a4a0a58d6bb4803527dacb6641c027816 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Tue, 28 Jan 2014 13:34:12 +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/AuthenticationPolicyState.java | 52 ++++++++++++++++++++++------------------------------
1 files changed, 22 insertions(+), 30 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/api/AuthenticationPolicyState.java b/opendj3-server-dev/src/server/org/opends/server/api/AuthenticationPolicyState.java
index 133864f..2de4f88 100644
--- a/opendj3-server-dev/src/server/org/opends/server/api/AuthenticationPolicyState.java
+++ b/opendj3-server-dev/src/server/org/opends/server/api/AuthenticationPolicyState.java
@@ -31,8 +31,6 @@
import static org.opends.messages.CoreMessages.*;
import static org.opends.server.config.ConfigConstants.OP_ATTR_ACCOUNT_DISABLED;
-import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.debug.DebugLogger.getTracer;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
import static org.opends.server.util.StaticUtils.toLowerCase;
@@ -40,7 +38,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.core.DirectoryServer;
-import org.opends.server.loggers.debug.DebugTracer;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.server.schema.GeneralizedTimeSyntax;
import org.opends.server.types.*;
import org.forgerock.opendj.ldap.ByteString;
@@ -54,10 +52,7 @@
*/
public abstract class AuthenticationPolicyState
{
- /**
- * The tracer object for the debug logger.
- */
- private static final DebugTracer TRACER = getTracer();
+ private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -130,9 +125,9 @@
if (valueString.equals("true") || valueString.equals("yes")
|| valueString.equals("on") || valueString.equals("1"))
{
- if (debugEnabled())
+ if (logger.isTraceEnabled())
{
- TRACER.debugInfo("Attribute %s resolves to true for user entry "
+ logger.trace("Attribute %s resolves to true for user entry "
+ "%s", attributeType.getNameOrOID(),
entry.getName().toString());
}
@@ -143,9 +138,9 @@
if (valueString.equals("false") || valueString.equals("no")
|| valueString.equals("off") || valueString.equals("0"))
{
- if (debugEnabled())
+ if (logger.isTraceEnabled())
{
- TRACER.debugInfo("Attribute %s resolves to false for user "
+ logger.trace("Attribute %s resolves to false for user "
+ "entry %s", attributeType.getNameOrOID(), entry.getName()
.toString());
}
@@ -153,9 +148,9 @@
return ConditionResult.FALSE;
}
- if (debugEnabled())
+ if (logger.isTraceEnabled())
{
- TRACER.debugError("Unable to resolve value %s for attribute %s "
+ logger.trace("Unable to resolve value %s for attribute %s "
+ "in user entry %s as a Boolean.", valueString,
attributeType.getNameOrOID(), entry.getName().toString());
}
@@ -168,9 +163,9 @@
}
}
- if (debugEnabled())
+ if (logger.isTraceEnabled())
{
- TRACER.debugInfo("Returning %s because attribute %s does not exist "
+ logger.trace("Returning %s because attribute %s does not exist "
+ "in user entry %s", ConditionResult.UNDEFINED.toString(),
attributeType.getNameOrOID(), entry.getName().toString());
}
@@ -218,11 +213,11 @@
}
catch (final Exception e)
{
- if (debugEnabled())
+ if (logger.isTraceEnabled())
{
- TRACER.debugCaught(DebugLogLevel.ERROR, e);
+ logger.traceException(e);
- TRACER.debugWarning("Unable to decode value %s for attribute %s "
+ logger.trace("Unable to decode value %s for attribute %s "
+ "in user entry %s: %s", v.getValue().toString(),
attributeType.getNameOrOID(), entry.getName().toString(),
stackTraceToSingleLineString(e));
@@ -240,9 +235,9 @@
if (timeValue == -1)
{
- if (debugEnabled())
+ if (logger.isTraceEnabled())
{
- TRACER.debugInfo("Returning -1 because attribute %s does not "
+ logger.trace("Returning -1 because attribute %s does not "
+ "exist in user entry %s", attributeType.getNameOrOID(), entry
.getName().toString());
}
@@ -324,15 +319,12 @@
}
catch (final Exception e)
{
- if (debugEnabled())
- {
- TRACER.debugCaught(DebugLogLevel.ERROR, e);
- }
+ logger.traceException(e);
isDisabled = ConditionResult.TRUE;
- if (debugEnabled())
+ if (logger.isTraceEnabled())
{
- TRACER.debugWarning("User %s is considered administratively "
+ logger.trace("User %s is considered administratively "
+ "disabled because an error occurred while "
+ "attempting to make the determination: %s.", userEntry.getName()
.toString(), stackTraceToSingleLineString(e));
@@ -344,18 +336,18 @@
if (isDisabled == ConditionResult.UNDEFINED)
{
isDisabled = ConditionResult.FALSE;
- if (debugEnabled())
+ if (logger.isTraceEnabled())
{
- TRACER.debugInfo("User %s is not administratively disabled since "
+ logger.trace("User %s is not administratively disabled since "
+ "the attribute \"%s\" is not present in the entry.", userEntry
.getName().toString(), OP_ATTR_ACCOUNT_DISABLED);
}
return false;
}
- if (debugEnabled())
+ if (logger.isTraceEnabled())
{
- TRACER.debugInfo("User %s %s administratively disabled.", userEntry
+ logger.trace("User %s %s administratively disabled.", userEntry
.getName().toString(), ((isDisabled == ConditionResult.TRUE) ? " is"
: " is not"));
}
--
Gitblit v1.10.0