From 1d837a835c04078ec66325e9fb9de21ac401874e Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Wed, 30 Nov 2016 15:10:15 +0700 Subject: prevent string concatenation for disabled loggers --- .../java/com/juick/service/security/SimpleRememberMeServices.java | 8 ++++++-- .../main/java/rocks/xmpp/core/session/debug/LogbackDebugger.java | 6 ++---- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'juick-server/src/main') diff --git a/juick-server/src/main/java/com/juick/service/security/SimpleRememberMeServices.java b/juick-server/src/main/java/com/juick/service/security/SimpleRememberMeServices.java index 2a28866c..aef133d3 100644 --- a/juick-server/src/main/java/com/juick/service/security/SimpleRememberMeServices.java +++ b/juick-server/src/main/java/com/juick/service/security/SimpleRememberMeServices.java @@ -5,6 +5,8 @@ import com.juick.server.security.entities.JuickUser; import com.juick.service.UserService; import com.juick.util.UserUtils; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.core.env.Environment; import org.springframework.security.core.Authentication; import org.springframework.security.core.userdetails.UserDetails; @@ -23,6 +25,8 @@ import java.util.Optional; * Created by aalexeev on 11/28/16. */ public class SimpleRememberMeServices extends AbstractRememberMeServices implements RememberMeServices { + private static final Logger logger = LoggerFactory.getLogger(SimpleRememberMeServices.class); + private final UserService userService; public SimpleRememberMeServices( @@ -49,7 +53,7 @@ public class SimpleRememberMeServices extends AbstractRememberMeServices impleme HttpServletRequest request, HttpServletResponse response, Authentication successfulAuthentication) { String username = successfulAuthentication.getName(); - logger.debug("Creating new persistent login for user " + username); + logger.debug("Creating new persistent login for user {}", username); try { int uid = userService.getUIDbyName(username); @@ -62,7 +66,7 @@ public class SimpleRememberMeServices extends AbstractRememberMeServices impleme setCookie(new String[]{hash}, getTokenValiditySeconds(), request, response); } catch (Exception e) { - logger.error("Failed to save cookies ", e); + logger.error("Failed to save cookies", e); } } diff --git a/juick-server/src/main/java/rocks/xmpp/core/session/debug/LogbackDebugger.java b/juick-server/src/main/java/rocks/xmpp/core/session/debug/LogbackDebugger.java index 4b2da8b7..3da660b2 100644 --- a/juick-server/src/main/java/rocks/xmpp/core/session/debug/LogbackDebugger.java +++ b/juick-server/src/main/java/rocks/xmpp/core/session/debug/LogbackDebugger.java @@ -11,22 +11,20 @@ import java.io.OutputStream; * Created by vitalyster on 17.11.2016. */ public class LogbackDebugger implements XmppDebugger { - private static final Logger logger = LoggerFactory.getLogger(LogbackDebugger.class); @Override public void initialize(XmppSession xmppSession) { - } @Override public void writeStanza(String s, Object o) { - logger.info("OUT: " + s); + logger.info("OUT: {}", s); } @Override public void readStanza(String s, Object o) { - logger.info("IN: " + s); + logger.info("IN: {}", s); } @Override -- cgit v1.2.3