keycloak-aplcache

Details

diff --git a/services/src/main/java/org/keycloak/services/resources/AbstractSecuredLocalService.java b/services/src/main/java/org/keycloak/services/resources/AbstractSecuredLocalService.java
index 956b1e1..8d7765f 100755
--- a/services/src/main/java/org/keycloak/services/resources/AbstractSecuredLocalService.java
+++ b/services/src/main/java/org/keycloak/services/resources/AbstractSecuredLocalService.java
@@ -1,6 +1,21 @@
+/*
+ * Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
 package org.keycloak.services.resources;
 
-import org.jboss.logging.Logger;
 import org.jboss.resteasy.spi.BadRequestException;
 import org.jboss.resteasy.spi.HttpRequest;
 import org.keycloak.AbstractOAuthClient;
@@ -12,6 +27,7 @@ import org.keycloak.models.RealmModel;
 import org.keycloak.models.utils.KeycloakModelUtils;
 import org.keycloak.protocol.oidc.OIDCLoginProtocolService;
 import org.keycloak.services.ForbiddenException;
+import org.keycloak.services.ServicesLogger;
 import org.keycloak.services.managers.AppAuthManager;
 import org.keycloak.services.managers.Auth;
 import org.keycloak.services.managers.AuthenticationManager;
@@ -39,7 +55,7 @@ import java.util.Set;
  * @version $Revision: 1 $
  */
 public abstract class AbstractSecuredLocalService {
-    private static final Logger logger = Logger.getLogger(AbstractSecuredLocalService.class);
+    private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
 
     private static final String KEYCLOAK_STATE_CHECKER = "KEYCLOAK_STATE_CHECKER";
 
diff --git a/services/src/main/java/org/keycloak/services/resources/AccountService.java b/services/src/main/java/org/keycloak/services/resources/AccountService.java
index 38833b7..9908900 100755
--- a/services/src/main/java/org/keycloak/services/resources/AccountService.java
+++ b/services/src/main/java/org/keycloak/services/resources/AccountService.java
@@ -51,6 +51,7 @@ import org.keycloak.protocol.oidc.utils.RedirectUtils;
 import org.keycloak.representations.idm.CredentialRepresentation;
 import org.keycloak.representations.idm.UserRepresentation;
 import org.keycloak.services.ForbiddenException;
+import org.keycloak.services.ServicesLogger;
 import org.keycloak.services.Urls;
 import org.keycloak.services.managers.AppAuthManager;
 import org.keycloak.services.managers.Auth;
@@ -91,7 +92,7 @@ import java.util.UUID;
  */
 public class AccountService extends AbstractSecuredLocalService {
 
-    private static final Logger logger = Logger.getLogger(AccountService.class);
+    private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
 
     private static Set<String> VALID_PATHS = new HashSet<String>();
     static {
@@ -641,11 +642,11 @@ public class AccountService extends AbstractSecuredLocalService {
             setReferrerOnPage();
             return account.setError(Messages.READ_ONLY_PASSWORD).createResponse(AccountPages.PASSWORD);
         }catch (ModelException me) {
-            logger.error("Failed to update password", me);
+            logger.failedToUpdatePassword(me);
             setReferrerOnPage();
             return account.setError(me.getMessage(), me.getParameters()).createResponse(AccountPages.PASSWORD);
         }catch (Exception ape) {
-            logger.error("Failed to update password", ape);
+            logger.failedToUpdatePassword(ape);
             setReferrerOnPage();
             return account.setError(ape.getMessage()).createResponse(AccountPages.PASSWORD);
         }
diff --git a/services/src/main/java/org/keycloak/services/resources/ClientsManagementService.java b/services/src/main/java/org/keycloak/services/resources/ClientsManagementService.java
index a933712..93ddabd 100755
--- a/services/src/main/java/org/keycloak/services/resources/ClientsManagementService.java
+++ b/services/src/main/java/org/keycloak/services/resources/ClientsManagementService.java
@@ -1,6 +1,21 @@
+/*
+ * Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
 package org.keycloak.services.resources;
 
-import org.jboss.logging.Logger;
 import org.jboss.resteasy.spi.BadRequestException;
 import org.jboss.resteasy.spi.HttpRequest;
 import org.jboss.resteasy.spi.UnauthorizedException;
@@ -16,6 +31,7 @@ import org.keycloak.models.KeycloakSession;
 import org.keycloak.models.RealmModel;
 import org.keycloak.protocol.oidc.utils.AuthorizeClientUtil;
 import org.keycloak.services.ForbiddenException;
+import org.keycloak.services.ServicesLogger;
 import org.keycloak.common.util.Time;
 
 import javax.ws.rs.HeaderParam;
@@ -38,7 +54,7 @@ import java.util.Map;
  */
 public class ClientsManagementService {
 
-    protected static final Logger logger = Logger.getLogger(ClientsManagementService.class);
+    protected static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
 
     private RealmModel realm;
 
diff --git a/services/src/main/java/org/keycloak/services/resources/Cors.java b/services/src/main/java/org/keycloak/services/resources/Cors.java
index 09b3ea7..a8e518c 100755
--- a/services/src/main/java/org/keycloak/services/resources/Cors.java
+++ b/services/src/main/java/org/keycloak/services/resources/Cors.java
@@ -1,11 +1,27 @@
+/*
+ * Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
 package org.keycloak.services.resources;
 
-import org.jboss.logging.Logger;
 import org.jboss.resteasy.spi.HttpRequest;
 import org.jboss.resteasy.spi.HttpResponse;
 import org.keycloak.models.ClientModel;
 import org.keycloak.representations.AccessToken;
 import org.keycloak.common.util.CollectionUtil;
+import org.keycloak.services.ServicesLogger;
 
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.ResponseBuilder;
@@ -18,7 +34,7 @@ import java.util.concurrent.TimeUnit;
  * @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
  */
 public class Cors {
-    protected static final Logger logger = Logger.getLogger(Cors.class);
+    protected static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
 
     public static final long DEFAULT_MAX_AGE = TimeUnit.HOURS.toSeconds(1);
     public static final String DEFAULT_ALLOW_METHODS = "GET, HEAD, OPTIONS";
diff --git a/services/src/main/java/org/keycloak/services/resources/IdentityBrokerService.java b/services/src/main/java/org/keycloak/services/resources/IdentityBrokerService.java
old mode 100755
new mode 100644
index 823917b..937df16
--- a/services/src/main/java/org/keycloak/services/resources/IdentityBrokerService.java
+++ b/services/src/main/java/org/keycloak/services/resources/IdentityBrokerService.java
@@ -1,7 +1,7 @@
 /*
  * JBoss, Home of Professional Open Source
  *
- * Copyright 2013 Red Hat, Inc. and/or its affiliates.
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
  */
 package org.keycloak.services.resources;
 
-import org.jboss.logging.Logger;
 import org.jboss.resteasy.spi.HttpRequest;
 import org.jboss.resteasy.spi.ResteasyProviderFactory;
 import org.keycloak.OAuth2Constants;
@@ -60,6 +59,7 @@ import org.keycloak.services.managers.ClientSessionCode;
 import org.keycloak.services.messages.Messages;
 import org.keycloak.services.ErrorResponse;
 import org.keycloak.services.ErrorPage;
+import org.keycloak.services.ServicesLogger;
 import org.keycloak.services.Urls;
 import org.keycloak.services.validation.Validation;
 import org.keycloak.broker.social.SocialIdentityProvider;
@@ -93,7 +93,7 @@ import static org.keycloak.models.Constants.ACCOUNT_MANAGEMENT_CLIENT_ID;
  */
 public class IdentityBrokerService implements IdentityProvider.AuthenticationCallback {
 
-    private static final Logger LOGGER = Logger.getLogger(IdentityBrokerService.class);
+    private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
 
     private final RealmModel realmModel;
 
@@ -138,7 +138,7 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
         this.event.detail(Details.IDENTITY_PROVIDER, providerId);
 
         if (isDebugEnabled()) {
-            LOGGER.debugf("Sending authentication request to identity provider [%s].", providerId);
+            logger.debugf("Sending authentication request to identity provider [%s].", providerId);
         }
 
         try {
@@ -148,7 +148,7 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
 
             if (response != null) {
                 if (isDebugEnabled()) {
-                    LOGGER.debugf("Identity provider [%s] is going to send a request [%s].", identityProvider, response);
+                    logger.debugf("Identity provider [%s] is going to send a request [%s].", identityProvider, response);
                 }
                 return response;
             }
@@ -252,7 +252,7 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
         String providerId = identityProviderConfig.getAlias();
         if (!identityProviderConfig.isStoreToken()) {
             if (isDebugEnabled()) {
-                LOGGER.debugf("Token will not be stored for identity provider [%s].", providerId);
+                logger.debugf("Token will not be stored for identity provider [%s].", providerId);
             }
             context.setToken(null);
         }
@@ -288,7 +288,7 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
 
         if (federatedUser == null) {
 
-            LOGGER.debugf("Federated user not found for provider '%s' and broker username '%s' . Redirecting to flow for firstBrokerLogin", providerId, context.getUsername());
+            logger.debugf("Federated user not found for provider '%s' and broker username '%s' . Redirecting to flow for firstBrokerLogin", providerId, context.getUsername());
 
             String username = context.getModelUsername();
             if (username == null) {
@@ -371,7 +371,7 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
             String isRegisteredNewUser = clientSession.getNote(AbstractIdpAuthenticator.BROKER_REGISTERED_NEW_USER);
             if (Boolean.parseBoolean(isRegisteredNewUser)) {
 
-                LOGGER.debugf("Registered new user '%s' after first login with identity provider '%s'. Identity provider username is '%s' . ", federatedUser.getUsername(), providerId, context.getUsername());
+                logger.debugf("Registered new user '%s' after first login with identity provider '%s'. Identity provider username is '%s' . ", federatedUser.getUsername(), providerId, context.getUsername());
 
                 context.getIdp().importNewUser(session, realmModel, federatedUser, context);
                 Set<IdentityProviderMapperModel> mappers = realmModel.getIdentityProviderMappersByAlias(providerId);
@@ -384,7 +384,7 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
                 }
 
                 if (context.getIdpConfig().isTrustEmail() && !Validation.isBlank(federatedUser.getEmail()) && !Boolean.parseBoolean(clientSession.getNote(AbstractIdpAuthenticator.UPDATE_PROFILE_EMAIL_CHANGED))) {
-                    LOGGER.debugf("Email verified automatically after registration of user '%s' through Identity provider '%s' ", federatedUser.getUsername(), context.getIdpConfig().getAlias());
+                    logger.debugf("Email verified automatically after registration of user '%s' through Identity provider '%s' ", federatedUser.getUsername(), context.getIdpConfig().getAlias());
                     federatedUser.setEmailVerified(true);
                 }
 
@@ -394,7 +394,7 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
                         .success();
 
             } else {
-                LOGGER.debugf("Linked existing keycloak user '%s' with identity provider '%s' . Identity provider username is '%s' .", federatedUser.getUsername(), providerId, context.getUsername());
+                logger.debugf("Linked existing keycloak user '%s' with identity provider '%s' . Identity provider username is '%s' .", federatedUser.getUsername(), providerId, context.getUsername());
 
                 event.event(EventType.FEDERATED_IDENTITY_LINK)
                         .success();
@@ -414,11 +414,11 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
         String postBrokerLoginFlowId = context.getIdpConfig().getPostBrokerLoginFlowId();
         if (postBrokerLoginFlowId == null) {
 
-            LOGGER.debugf("Skip redirect to postBrokerLogin flow. PostBrokerLogin flow not set for identityProvider '%s'.", context.getIdpConfig().getAlias());
+            logger.debugf("Skip redirect to postBrokerLogin flow. PostBrokerLogin flow not set for identityProvider '%s'.", context.getIdpConfig().getAlias());
             return afterPostBrokerLoginFlowSuccess(clientSession, context, wasFirstBrokerLogin);
         } else {
 
-            LOGGER.debugf("Redirect to postBrokerLogin flow after authentication with identityProvider '%s'.", context.getIdpConfig().getAlias());
+            logger.debugf("Redirect to postBrokerLogin flow after authentication with identityProvider '%s'.", context.getIdpConfig().getAlias());
 
             clientSession.setTimestamp(Time.currentTime());
 
@@ -489,7 +489,7 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
 
             boolean firstBrokerLoginInProgress = (clientSession.getNote(AbstractIdpAuthenticator.BROKERED_CONTEXT_NOTE) != null);
             if (firstBrokerLoginInProgress) {
-                LOGGER.debugf("Reauthenticated with broker '%s' when linking user '%s' with other broker", context.getIdpConfig().getAlias(), federatedUser.getUsername());
+                logger.debugf("Reauthenticated with broker '%s' when linking user '%s' with other broker", context.getIdpConfig().getAlias(), federatedUser.getUsername());
 
                 UserModel linkingUser = AbstractIdpAuthenticator.getExistingUser(session, realmModel, clientSession);
                 if (!linkingUser.getId().equals(federatedUser.getId())) {
@@ -517,7 +517,7 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
         userSession.setNote(Details.IDENTITY_PROVIDER_USERNAME, context.getUsername());
 
         if (isDebugEnabled()) {
-            LOGGER.debugf("Performing local authentication for user [%s].", federatedUser);
+            logger.debugf("Performing local authentication for user [%s].", federatedUser);
         }
 
         return AuthenticationProcessor.redirectToRequiredActions(realmModel, clientSession, uriInfo);
@@ -553,7 +553,7 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
         UserModel authenticatedUser = clientSession.getUserSession().getUser();
 
         if (isDebugEnabled()) {
-            LOGGER.debugf("Linking account [%s] from identity provider [%s] to user [%s].", federatedIdentityModel, context.getIdpConfig().getAlias(), authenticatedUser);
+            logger.debugf("Linking account [%s] from identity provider [%s] to user [%s].", federatedIdentityModel, context.getIdpConfig().getAlias(), authenticatedUser);
         }
 
         if (!authenticatedUser.isEnabled()) {
@@ -585,7 +585,7 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
             this.session.users().updateFederatedIdentity(this.realmModel, federatedUser, federatedIdentityModel);
 
             if (isDebugEnabled()) {
-                LOGGER.debugf("Identity [%s] update with response from identity provider [%s].", federatedUser, context.getIdpConfig().getAlias());
+                logger.debugf("Identity [%s] update with response from identity provider [%s].", federatedUser, context.getIdpConfig().getAlias());
             }
         }
         context.getIdp().updateBrokeredUser(session, realmModel, federatedUser, context);
@@ -613,7 +613,7 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
                     throw new IdentityBrokerException("Invalid client");
                 }
 
-                LOGGER.debugf("Got authorization code from client [%s].", client.getClientId());
+                logger.debugf("Got authorization code from client [%s].", client.getClientId());
                 this.event.client(client);
                 this.session.getContext().setClient(client);
 
@@ -623,7 +623,7 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
             }
 
             if (isDebugEnabled()) {
-                LOGGER.debugf("Authorization code is valid.");
+                logger.debugf("Authorization code is valid.");
             }
 
             return clientCode;
@@ -777,15 +777,15 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
                     this.session.getTransaction().commit();
                 }
             } catch (Exception e) {
-                LOGGER.error("Could not fire event.", e);
+                logger.couldNotFireEvent(e);
                 rollback();
             }
         }
 
         if (throwable != null) {
-            LOGGER.error(message, throwable);
+            logger.error(message, throwable);
         } else {
-            LOGGER.error(message);
+            logger.error(message);
         }
     }
 
@@ -794,7 +794,7 @@ public class IdentityBrokerService implements IdentityProvider.AuthenticationCal
     }
 
     private boolean isDebugEnabled() {
-        return LOGGER.isDebugEnabled();
+        return logger.isDebugEnabled();
     }
 
     private void rollback() {
diff --git a/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java b/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java
index e619183..38cc097 100644
--- a/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java
+++ b/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.keycloak.services.resources;
 
 import com.fasterxml.jackson.core.type.TypeReference;
@@ -44,7 +61,7 @@ import java.util.*;
  */
 public class KeycloakApplication extends Application {
 
-    private static final ServicesLogger log = ServicesLogger.ROOT_LOGGER;
+    private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
 
     protected Set<Object> singletons = new HashSet<Object>();
     protected Set<Class<?>> classes = new HashSet<Class<?>>();
@@ -135,7 +152,7 @@ public class KeycloakApplication extends Application {
             session.getTransaction().commit();
         } catch (Exception e) {
             session.getTransaction().rollback();
-            log.migrationFailure(e);
+            logger.migrationFailure(e);
         } finally {
             session.close();
         }
@@ -163,7 +180,7 @@ public class KeycloakApplication extends Application {
             if (configDir != null) {
                 File f = new File(configDir + File.separator + "keycloak-server.json");
                 if (f.isFile()) {
-                    log.loadingFrom(f.getAbsolutePath());
+                    logger.loadingFrom(f.getAbsolutePath());
                     node = new ObjectMapper().readTree(f);
                 }
             }
@@ -171,7 +188,7 @@ public class KeycloakApplication extends Application {
             if (node == null) {
                 URL resource = Thread.currentThread().getContextClassLoader().getResource("META-INF/keycloak-server.json");
                 if (resource != null) {
-                    log.loadingFrom(resource);
+                    logger.loadingFrom(resource);
                     node = new ObjectMapper().readTree(resource);
                 }
             }
@@ -247,22 +264,22 @@ public class KeycloakApplication extends Application {
             manager.setContextPath(getContextPath());
 
             if (rep.getId() != null && manager.getRealm(rep.getId()) != null) {
-                log.realmExists(rep.getRealm(), from);
+                logger.realmExists(rep.getRealm(), from);
                 return;
             }
 
             if (manager.getRealmByName(rep.getRealm()) != null) {
-                log.realmExists(rep.getRealm(), from);
+                logger.realmExists(rep.getRealm(), from);
                 return;
             }
 
             try {
                 RealmModel realm = manager.importRealm(rep);
                 session.getTransaction().commit();
-                log.importedRealm(realm.getName(), from);
+                logger.importedRealm(realm.getName(), from);
             } catch (Throwable t) {
                 session.getTransaction().rollback();
-                log.unableToImportRealm(t, rep.getRealm(), from);
+                logger.unableToImportRealm(t, rep.getRealm(), from);
             }
         } finally {
             session.close();
@@ -274,14 +291,14 @@ public class KeycloakApplication extends Application {
         if (configDir != null) {
             File addUserFile = new File(configDir + File.separator + "keycloak-add-user.json");
             if (addUserFile.isFile()) {
-                log.imprtingUsersFrom(addUserFile);
+                logger.imprtingUsersFrom(addUserFile);
 
                 List<RealmRepresentation> realms;
                 try {
                     realms = JsonSerialization.readValue(new FileInputStream(addUserFile), new TypeReference<List<RealmRepresentation>>() {
                     });
                 } catch (IOException e) {
-                    log.failedToLoadUsers(e);
+                    logger.failedToLoadUsers(e);
                     return;
                 }
 
@@ -293,7 +310,7 @@ public class KeycloakApplication extends Application {
 
                             RealmModel realm = session.realms().getRealmByName(realmRep.getRealm());
                             if (realm == null) {
-                                log.addUserFailedRealmNotFound(userRep.getUsername(), realmRep.getRealm());
+                                logger.addUserFailedRealmNotFound(userRep.getUsername(), realmRep.getRealm());
                             } else {
                                 UserModel user = session.users().addUser(realm, userRep.getUsername());
                                 user.setEnabled(userRep.isEnabled());
@@ -302,12 +319,12 @@ public class KeycloakApplication extends Application {
                             }
 
                             session.getTransaction().commit();
-                            log.addUserSuccess(userRep.getUsername(), realmRep.getRealm());
+                            logger.addUserSuccess(userRep.getUsername(), realmRep.getRealm());
                         } catch (ModelDuplicateException e) {
-                            log.addUserFailedUserExists(userRep.getUsername(), realmRep.getRealm());
+                            logger.addUserFailedUserExists(userRep.getUsername(), realmRep.getRealm());
                         } catch (Throwable t) {
                             session.getTransaction().rollback();
-                            log.addUserFailed(t, userRep.getUsername(), realmRep.getRealm());
+                            logger.addUserFailed(t, userRep.getUsername(), realmRep.getRealm());
                         } finally {
                             session.close();
                         }
@@ -315,7 +332,7 @@ public class KeycloakApplication extends Application {
                 }
 
                 if (!addUserFile.delete()) {
-                    log.failedToDeleteFile(addUserFile.getAbsolutePath());
+                    logger.failedToDeleteFile(addUserFile.getAbsolutePath());
                 }
             }
         }
diff --git a/services/src/main/java/org/keycloak/services/resources/LoginActionsService.java b/services/src/main/java/org/keycloak/services/resources/LoginActionsService.java
index 87b390b..2967b67 100755
--- a/services/src/main/java/org/keycloak/services/resources/LoginActionsService.java
+++ b/services/src/main/java/org/keycloak/services/resources/LoginActionsService.java
@@ -21,7 +21,6 @@
  */
 package org.keycloak.services.resources;
 
-import org.jboss.logging.Logger;
 import org.jboss.resteasy.spi.HttpRequest;
 import org.keycloak.authentication.authenticators.broker.AbstractIdpAuthenticator;
 import org.keycloak.authentication.authenticators.broker.util.PostBrokerLoginConstants;
@@ -63,6 +62,7 @@ import org.keycloak.protocol.oidc.OIDCLoginProtocol;
 import org.keycloak.protocol.oidc.utils.OIDCResponseMode;
 import org.keycloak.protocol.oidc.utils.OIDCResponseType;
 import org.keycloak.services.ErrorPage;
+import org.keycloak.services.ServicesLogger;
 import org.keycloak.services.Urls;
 import org.keycloak.services.managers.AuthenticationManager;
 import org.keycloak.services.managers.ClientSessionCode;
@@ -91,7 +91,7 @@ import java.net.URI;
  */
 public class LoginActionsService {
 
-    protected static final Logger logger = Logger.getLogger(LoginActionsService.class);
+    protected static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
 
     public static final String ACTION_COOKIE = "KEYCLOAK_ACTION";
     public static final String AUTHENTICATE_PATH = "authenticate";
@@ -225,7 +225,7 @@ public class LoginActionsService {
                             return false;
                         }
                     } catch (Exception e) {
-                        logger.error("failed to parse RestartLoginCookie", e);
+                        logger.failedToParseRestartLoginCookie(e);
                     }
                 }
                 event.error(Errors.INVALID_CODE);
@@ -527,7 +527,7 @@ public class LoginActionsService {
         String noteKey = firstBrokerLogin ? AbstractIdpAuthenticator.BROKERED_CONTEXT_NOTE : PostBrokerLoginConstants.PBL_BROKERED_IDENTITY_CONTEXT;
         SerializedBrokeredIdentityContext serializedCtx = SerializedBrokeredIdentityContext.readFromClientSession(clientSessionn, noteKey);
         if (serializedCtx == null) {
-            logger.errorf("Not found serialized context in clientSession under note '%s'", noteKey);
+            logger.notFoundSerializedCtxInClientSession(noteKey);
             throw new WebApplicationException(ErrorPage.error(session, "Not found serialized context in clientSession."));
         }
         BrokeredIdentityContext brokerContext = serializedCtx.deserialize(session, clientSessionn);
@@ -535,12 +535,12 @@ public class LoginActionsService {
 
         String flowId = firstBrokerLogin ? brokerContext.getIdpConfig().getFirstBrokerLoginFlowId() : brokerContext.getIdpConfig().getPostBrokerLoginFlowId();
         if (flowId == null) {
-            logger.errorf("Flow not configured for identity provider '%s'", identityProviderAlias);
+            logger.flowNotConfigForIDP(identityProviderAlias);
             throw new WebApplicationException(ErrorPage.error(session, "Flow not configured for identity provider"));
         }
         AuthenticationFlowModel brokerLoginFlow = realm.getAuthenticationFlowById(flowId);
         if (brokerLoginFlow == null) {
-            logger.errorf("Not found configured flow with ID '%s' for identity provider '%s'", flowId, identityProviderAlias);
+            logger.flowNotFoundForIDP(flowId, identityProviderAlias);
             throw new WebApplicationException(ErrorPage.error(session, "Flow not found for identity provider"));
         }
 
@@ -659,7 +659,7 @@ public class LoginActionsService {
             ClientSessionCode accessCode = checks.clientCode;
             ClientSessionModel clientSession = accessCode.getClientSession();
             if (!ClientSessionModel.Action.VERIFY_EMAIL.name().equals(clientSession.getNote(AuthenticationManager.CURRENT_REQUIRED_ACTION))) {
-                logger.error("required action doesn't match current required action");
+                logger.reqdActionDoesNotMatch();
                 event.error(Errors.INVALID_CODE);
                 throw new WebApplicationException(ErrorPage.error(session, Messages.INVALID_CODE));
             }
@@ -672,7 +672,7 @@ public class LoginActionsService {
             String keyFromSession = clientSession.getNote(Constants.VERIFY_EMAIL_KEY);
             clientSession.removeNote(Constants.VERIFY_EMAIL_KEY);
             if (!key.equals(keyFromSession)) {
-                logger.error("Invalid key for email verification");
+                logger.invalidKeyForEmailVerification();
                 event.error(Errors.INVALID_USER_CREDENTIALS);
                 throw new WebApplicationException(ErrorPage.error(session, Messages.INVALID_CODE));
             }
@@ -813,7 +813,7 @@ public class LoginActionsService {
         final ClientSessionModel clientSession = clientCode.getClientSession();
 
         if (clientSession.getUserSession() == null) {
-            logger.error("user session was null");
+            logger.userSessionNull();
             event.error(Errors.USER_SESSION_NOT_FOUND);
             throw new WebApplicationException(ErrorPage.error(session, Messages.SESSION_NOT_ACTIVE));
         }
@@ -831,7 +831,7 @@ public class LoginActionsService {
 
         RequiredActionFactory factory = (RequiredActionFactory)session.getKeycloakSessionFactory().getProviderFactory(RequiredActionProvider.class, action);
         if (factory == null) {
-            logger.error("required action provider was null");
+            logger.actionProviderNull();
             event.error(Errors.INVALID_CODE);
             throw new WebApplicationException(ErrorPage.error(session, Messages.INVALID_CODE));
         }
diff --git a/services/src/main/java/org/keycloak/services/resources/ModelExceptionMapper.java b/services/src/main/java/org/keycloak/services/resources/ModelExceptionMapper.java
index 4926490..643348e 100644
--- a/services/src/main/java/org/keycloak/services/resources/ModelExceptionMapper.java
+++ b/services/src/main/java/org/keycloak/services/resources/ModelExceptionMapper.java
@@ -1,3 +1,20 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.keycloak.services.resources;
 
 import javax.ws.rs.core.Context;
@@ -5,11 +22,11 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.Provider;
 
-import org.jboss.logging.Logger;
 import org.keycloak.messages.MessagesProvider;
 import org.keycloak.models.KeycloakSession;
 import org.keycloak.models.ModelException;
 import org.keycloak.services.ErrorResponse;
+import org.keycloak.services.ServicesLogger;
 
 /**
  * @author <a href="mailto:leonardo.zanivan@gmail.com">Leonardo Zanivan</a>
@@ -17,7 +34,7 @@ import org.keycloak.services.ErrorResponse;
 @Provider
 public class ModelExceptionMapper implements ExceptionMapper<ModelException> {
 
-    private static final Logger logger = Logger.getLogger(ModelExceptionMapper.class);
+    private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
 
     @Context
     private KeycloakSession session;
diff --git a/services/src/main/java/org/keycloak/services/resources/PublicRealmResource.java b/services/src/main/java/org/keycloak/services/resources/PublicRealmResource.java
index 6758af9..42ce480 100755
--- a/services/src/main/java/org/keycloak/services/resources/PublicRealmResource.java
+++ b/services/src/main/java/org/keycloak/services/resources/PublicRealmResource.java
@@ -1,12 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.keycloak.services.resources;
 
-import org.jboss.logging.Logger;
 import org.jboss.resteasy.annotations.cache.NoCache;
 import org.jboss.resteasy.spi.HttpRequest;
 import org.jboss.resteasy.spi.HttpResponse;
 import org.keycloak.models.RealmModel;
 import org.keycloak.protocol.oidc.OIDCLoginProtocolService;
 import org.keycloak.representations.idm.PublishedRealmRepresentation;
+import org.keycloak.services.ServicesLogger;
 import org.keycloak.services.resources.admin.AdminRoot;
 
 import javax.ws.rs.GET;
@@ -25,7 +42,7 @@ import javax.ws.rs.core.UriInfo;
  * @version $Revision: 1 $
  */
 public class PublicRealmResource {
-    protected static final  Logger logger = Logger.getLogger(PublicRealmResource.class);
+    protected static final  ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
 
     @Context
     protected UriInfo uriInfo;
diff --git a/services/src/main/java/org/keycloak/services/resources/RealmsResource.java b/services/src/main/java/org/keycloak/services/resources/RealmsResource.java
index e3a418d..3a764d6 100755
--- a/services/src/main/java/org/keycloak/services/resources/RealmsResource.java
+++ b/services/src/main/java/org/keycloak/services/resources/RealmsResource.java
@@ -1,6 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.keycloak.services.resources;
 
-import org.jboss.logging.Logger;
 import org.jboss.resteasy.spi.NotFoundException;
 import org.jboss.resteasy.spi.ResteasyProviderFactory;
 import org.keycloak.common.ClientConnection;
@@ -13,6 +29,7 @@ import org.keycloak.protocol.LoginProtocol;
 import org.keycloak.protocol.LoginProtocolFactory;
 import org.keycloak.protocol.oidc.OIDCLoginProtocol;
 import org.keycloak.protocol.oidc.OIDCLoginProtocolService;
+import org.keycloak.services.ServicesLogger;
 import org.keycloak.services.clientregistration.ClientRegistrationService;
 import org.keycloak.services.managers.RealmManager;
 import org.keycloak.services.util.CacheControlUtil;
@@ -31,7 +48,7 @@ import javax.ws.rs.core.*;
  */
 @Path("/realms")
 public class RealmsResource {
-    protected static Logger logger = Logger.getLogger(RealmsResource.class);
+    protected static ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
 
     @Context
     protected KeycloakSession session;
diff --git a/services/src/main/java/org/keycloak/services/resources/ServerVersionResource.java b/services/src/main/java/org/keycloak/services/resources/ServerVersionResource.java
index ffc3aa3..29ebcb6 100755
--- a/services/src/main/java/org/keycloak/services/resources/ServerVersionResource.java
+++ b/services/src/main/java/org/keycloak/services/resources/ServerVersionResource.java
@@ -1,10 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.keycloak.services.resources;
 
-import org.jboss.logging.Logger;
 import org.jboss.resteasy.annotations.cache.NoCache;
 import org.jboss.resteasy.spi.HttpRequest;
 import org.jboss.resteasy.spi.HttpResponse;
 import org.keycloak.representations.VersionRepresentation;
+import org.keycloak.services.ServicesLogger;
 
 import javax.ws.rs.GET;
 import javax.ws.rs.OPTIONS;
@@ -21,7 +38,7 @@ import javax.ws.rs.core.Response;
 @Path("/version")
 public class ServerVersionResource {
 
-    protected static final Logger logger = Logger.getLogger(ServerVersionResource.class);
+    protected static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
 
     @Context
     protected HttpRequest request;
diff --git a/services/src/main/java/org/keycloak/services/resources/ThemeResource.java b/services/src/main/java/org/keycloak/services/resources/ThemeResource.java
old mode 100755
new mode 100644
index 1bc5f49..658f911
--- a/services/src/main/java/org/keycloak/services/resources/ThemeResource.java
+++ b/services/src/main/java/org/keycloak/services/resources/ThemeResource.java
@@ -1,11 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.keycloak.services.resources;
 
-import org.jboss.logging.Logger;
 import org.keycloak.common.Version;
 import org.keycloak.theme.Theme;
 import org.keycloak.theme.ThemeProvider;
 import org.keycloak.models.KeycloakSession;
 import org.keycloak.common.util.MimeTypeUtil;
+import org.keycloak.services.ServicesLogger;
 import org.keycloak.services.util.CacheControlUtil;
 
 import javax.ws.rs.GET;
@@ -23,7 +40,7 @@ import java.io.InputStream;
 @Path("/resources")
 public class ThemeResource {
 
-    private static final Logger logger = Logger.getLogger(ThemeResource.class);
+    private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
 
     @Context
     private KeycloakSession session;
@@ -53,7 +70,7 @@ public class ThemeResource {
                 return Response.status(Response.Status.NOT_FOUND).build();
             }
         } catch (Exception e) {
-            logger.warn("Failed to get theme resource", e);
+            logger.failedToGetThemeRequest(e);
             return Response.serverError().build();
         }
     }
diff --git a/services/src/main/java/org/keycloak/services/resources/WelcomeResource.java b/services/src/main/java/org/keycloak/services/resources/WelcomeResource.java
index 9b0dfac..0f2f00f 100755
--- a/services/src/main/java/org/keycloak/services/resources/WelcomeResource.java
+++ b/services/src/main/java/org/keycloak/services/resources/WelcomeResource.java
@@ -1,12 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.keycloak.services.resources;
 
-import org.jboss.logging.Logger;
 import org.keycloak.Config;
 import org.keycloak.theme.FreeMarkerUtil;
 import org.keycloak.theme.Theme;
 import org.keycloak.theme.ThemeProvider;
 import org.keycloak.models.KeycloakSession;
 import org.keycloak.common.util.MimeTypeUtil;
+import org.keycloak.services.ServicesLogger;
 import org.keycloak.services.managers.ApplianceBootstrap;
 import org.keycloak.services.util.CacheControlUtil;
 
@@ -27,7 +44,7 @@ import java.util.Map;
 @Path("/")
 public class WelcomeResource {
 
-    private static final Logger logger = Logger.getLogger(WelcomeResource.class);
+    private static final ServicesLogger logger = ServicesLogger.ROOT_LOGGER;
 
     private boolean bootstrap;
 
@@ -69,7 +86,7 @@ public class WelcomeResource {
             return createWelcomePage(null, null);
         } else {
             if (!isLocal()) {
-                logger.errorv("Rejected non-local attempt to create initial user from {0}", session.getContext().getConnection().getRemoteAddr());
+                logger.rejectedNonLocalAttemptToCreateInitialUser(session.getContext().getConnection().getRemoteAddr());
                 throw new WebApplicationException(Response.Status.BAD_REQUEST);
             }
 
@@ -94,10 +111,10 @@ public class WelcomeResource {
                 bootstrap = false;
                 applianceBootstrap.createMasterRealmUser(username, password);
 
-                logger.infov("Created initial admin user with username {0}", username);
+                logger.createdInitialAdminUser(username);
                 return createWelcomePage("User created", null);
             } else {
-                logger.warnv("Rejected attempt to create initial user as user is already created");
+                logger.initialUserAlreadyCreated();
                 return createWelcomePage(null, "Users already exists");
             }
         }
diff --git a/services/src/main/java/org/keycloak/services/ServicesLogger.java b/services/src/main/java/org/keycloak/services/ServicesLogger.java
index 2ddfa1d..ec84a80 100644
--- a/services/src/main/java/org/keycloak/services/ServicesLogger.java
+++ b/services/src/main/java/org/keycloak/services/ServicesLogger.java
@@ -295,4 +295,60 @@ public interface ServicesLogger extends BasicLogger {
     @LogMessage(level = WARN)
     @Message(id=64, value="Failed to load messages")
     void failedToloadMessages(@Cause IOException ioe);
+
+    @LogMessage(level = ERROR)
+    @Message(id=65, value="Failed to update Password")
+    void failedToUpdatePassword(@Cause Exception e);
+
+    @LogMessage(level = ERROR)
+    @Message(id=66, value="Could not fire event.")
+    void couldNotFireEvent(@Cause Exception e);
+
+    @LogMessage(level = ERROR)
+    @Message(id=67, value="failed to parse RestartLoginCookie")
+    void failedToParseRestartLoginCookie(@Cause Exception e);
+
+    @LogMessage(level = ERROR)
+    @Message(id=68, value="Not found serialized context in clientSession under note '%s'")
+    void notFoundSerializedCtxInClientSession(String noteKey);
+
+    @LogMessage(level = ERROR)
+    @Message(id=69, value="Flow not configured for identity provider '%s'")
+    void flowNotConfigForIDP(String identityProviderAlias);
+
+    @LogMessage(level = ERROR)
+    @Message(id=70, value="Not found configured flow with ID '%s' for identity provider '%s'")
+    void flowNotFoundForIDP(String flowId, String identityProviderAlias);
+
+    @LogMessage(level = ERROR)
+    @Message(id=71, value="required action doesn't match current required action")
+    void reqdActionDoesNotMatch();
+
+    @LogMessage(level = ERROR)
+    @Message(id=72, value="Invalid key for email verification")
+    void invalidKeyForEmailVerification();
+
+    @LogMessage(level = ERROR)
+    @Message(id=73, value="User session was null")
+    void userSessionNull();
+
+    @LogMessage(level = ERROR)
+    @Message(id=74, value="Required action provider was null")
+    void actionProviderNull();
+
+    @LogMessage(level = WARN)
+    @Message(id=75, value="Failed to get theme request")
+    void failedToGetThemeRequest(@Cause Exception e);
+
+    @LogMessage(level = ERROR)
+    @Message(id=76, value="Rejected non-local attempt to create initial user from %s")
+    void rejectedNonLocalAttemptToCreateInitialUser(String remoteAddr);
+
+    @LogMessage(level = INFO)
+    @Message(id=77, value="Created initial admin user with username %s")
+    void createdInitialAdminUser(String userName);
+
+    @LogMessage(level = WARN)
+    @Message(id=78, value="Rejected attempt to create initial user as user is already created")
+    void initialUserAlreadyCreated();
 }