diff --git a/services/src/main/java/org/keycloak/authentication/authenticators/browser/AbstractUsernameFormAuthenticator.java b/services/src/main/java/org/keycloak/authentication/authenticators/browser/AbstractUsernameFormAuthenticator.java index 68b036fa18..9cae5ef12c 100755 --- a/services/src/main/java/org/keycloak/authentication/authenticators/browser/AbstractUsernameFormAuthenticator.java +++ b/services/src/main/java/org/keycloak/authentication/authenticators/browser/AbstractUsernameFormAuthenticator.java @@ -1,6 +1,5 @@ package org.keycloak.authentication.authenticators.browser; -import org.jboss.logging.Logger; import org.keycloak.authentication.AbstractFormAuthenticator; import org.keycloak.authentication.AuthenticationFlowError; import org.keycloak.authentication.AuthenticationFlowContext; @@ -11,6 +10,7 @@ import org.keycloak.models.UserCredentialModel; import org.keycloak.models.UserModel; import org.keycloak.models.utils.KeycloakModelUtils; import org.keycloak.representations.idm.CredentialRepresentation; +import org.keycloak.services.ServicesLogger; import org.keycloak.services.managers.AuthenticationManager; import org.keycloak.services.messages.Messages; @@ -25,7 +25,7 @@ import java.util.List; */ public abstract class AbstractUsernameFormAuthenticator extends AbstractFormAuthenticator { - private static final Logger logger = Logger.getLogger(AbstractUsernameFormAuthenticator.class); + private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER; public static final String REGISTRATION_FORM_ACTION = "registration_form"; public static final String ATTEMPTED_USERNAME = "ATTEMPTED_USERNAME"; @@ -109,7 +109,7 @@ public abstract class AbstractUsernameFormAuthenticator extends AbstractFormAuth try { user = KeycloakModelUtils.findUserByNameOrEmail(context.getSession(), context.getRealm(), username); } catch (ModelDuplicateException mde) { - logger.error(mde.getMessage(), mde); + logger.modelDuplicateException(mde); // Could happen during federation import if (mde.getDuplicateFieldName() != null && mde.getDuplicateFieldName().equals(UserModel.EMAIL)) { diff --git a/services/src/main/java/org/keycloak/authentication/authenticators/browser/SpnegoAuthenticator.java b/services/src/main/java/org/keycloak/authentication/authenticators/browser/SpnegoAuthenticator.java index f1c0128661..ea6e27ac38 100755 --- a/services/src/main/java/org/keycloak/authentication/authenticators/browser/SpnegoAuthenticator.java +++ b/services/src/main/java/org/keycloak/authentication/authenticators/browser/SpnegoAuthenticator.java @@ -1,6 +1,5 @@ package org.keycloak.authentication.authenticators.browser; -import org.jboss.logging.Logger; import org.jboss.resteasy.spi.HttpRequest; import org.keycloak.authentication.AuthenticationFlowError; import org.keycloak.authentication.AuthenticationFlowContext; @@ -13,6 +12,7 @@ import org.keycloak.models.KeycloakSession; import org.keycloak.models.RealmModel; import org.keycloak.models.UserCredentialModel; import org.keycloak.models.UserModel; +import org.keycloak.services.ServicesLogger; import org.keycloak.services.messages.Messages; import javax.ws.rs.core.HttpHeaders; @@ -27,7 +27,7 @@ import java.util.Map; */ public class SpnegoAuthenticator extends AbstractUsernameFormAuthenticator implements Authenticator{ public static final String KERBEROS_DISABLED = "kerberos_disabled"; - protected static Logger logger = Logger.getLogger(SpnegoAuthenticator.class); + protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER; @Override public boolean requiresUser() { diff --git a/services/src/main/java/org/keycloak/authentication/authenticators/browser/UsernamePasswordForm.java b/services/src/main/java/org/keycloak/authentication/authenticators/browser/UsernamePasswordForm.java index a2581e3350..bbf36dc5c1 100755 --- a/services/src/main/java/org/keycloak/authentication/authenticators/browser/UsernamePasswordForm.java +++ b/services/src/main/java/org/keycloak/authentication/authenticators/browser/UsernamePasswordForm.java @@ -1,6 +1,5 @@ package org.keycloak.authentication.authenticators.browser; -import org.jboss.logging.Logger; import org.jboss.resteasy.specimpl.MultivaluedMapImpl; import org.keycloak.authentication.AuthenticationFlowContext; import org.keycloak.authentication.AuthenticationProcessor; @@ -10,6 +9,7 @@ import org.keycloak.models.KeycloakSession; import org.keycloak.models.RealmModel; import org.keycloak.models.UserModel; import org.keycloak.protocol.oidc.OIDCLoginProtocol; +import org.keycloak.services.ServicesLogger; import org.keycloak.services.managers.AuthenticationManager; import javax.ws.rs.core.MultivaluedMap; @@ -20,7 +20,7 @@ import javax.ws.rs.core.Response; * @version $Revision: 1 $ */ public class UsernamePasswordForm extends AbstractUsernameFormAuthenticator implements Authenticator { - protected static Logger logger = Logger.getLogger(UsernamePasswordForm.class); + protected static ServicesLogger log = ServicesLogger.ROOT_LOGGER; @Override public void action(AuthenticationFlowContext context) { diff --git a/services/src/main/java/org/keycloak/services/ServicesLogger.java b/services/src/main/java/org/keycloak/services/ServicesLogger.java index 7eefbbd471..e6d09f220e 100644 --- a/services/src/main/java/org/keycloak/services/ServicesLogger.java +++ b/services/src/main/java/org/keycloak/services/ServicesLogger.java @@ -27,6 +27,7 @@ import org.jboss.logging.annotations.MessageLogger; import static org.jboss.logging.Logger.Level.ERROR; import static org.jboss.logging.Logger.Level.INFO; import static org.jboss.logging.Logger.Level.WARN; +import org.keycloak.models.ModelDuplicateException; /** @@ -131,7 +132,7 @@ public interface ServicesLogger extends BasicLogger { @Message(id=23, value="Smtp is not configured for the realm. Ignoring email verification authenticator") void smtpNotConfigured(); - @LogMessage(level = WARN) - @Message(id=23, value="Smtp is not configured for the realm. Ignoring email verification authenticator") - void smtpNotConfigured(); + @LogMessage(level = ERROR) + @Message(id=24, value="") + void modelDuplicateException(@Cause ModelDuplicateException mde); }