Commit dd8e3a13 authored by michael.simon's avatar michael.simon
Browse files

Add remote ip address to MDC logging context

Can be retrieved by %X{ipAddr} in Logging pattern.
parent f1e6ccd7
......@@ -32,6 +32,7 @@ import javax.servlet.http.HttpSession;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.MDC;
import edu.kit.scc.webreg.bootstrap.ApplicationConfig;
import edu.kit.scc.webreg.entity.AdminUserEntity;
......@@ -86,6 +87,8 @@ public class SecurityFilter implements Filter {
request.setCharacterEncoding("UTF-8");
}
MDC.put("ipAddr", request.getRemoteAddr());
String context = request.getServletContext().getContextPath();
String path = request.getRequestURI().substring(
context.length());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment