added name of logged-in user to slow GWT RPC request log output

Change-Id: I5c417ec382dfa641cbc23b2e7851e56e7caed712
This commit is contained in:
Axel Uhl committed 2019-02-04 23:47:51 +01:00
1 parent a43a1680f5
commit 2444a86b88
2 files changed
+14 -1

No files matched your search

@@ -16,6 +16,8 @@ Import-Package: javax.servlet;version="3.1.0",
javax.servlet.descriptor;version="3.1.0",
javax.servlet.http;version="3.1.0",
org.apache.commons.io,
org.apache.shiro;version="1.2.2",
org.apache.shiro.subject;version="1.2.2",
org.json.simple,
org.json.simple.parser,
org.osgi.framework,
@@ -10,6 +10,8 @@ import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import com.google.gwt.user.client.rpc.SerializationException;
import com.google.gwt.user.server.rpc.RPCRequest;
@@ -136,7 +138,16 @@ public abstract class ProxiedRemoteServiceServlet extends RemoteServiceServlet {
final Duration processingDuration = startOfProcessing.until(endOfProcessing);
final Duration serializationDuration = endOfProcessing.until(afterResultSerialization);
final Duration totalDuration = startOfProcessing.until(afterResultSerialization);
logger.log(Level.WARNING, "GWT RPC Request "+request.getMethod()+" with parameters "+Arrays.toString(request.getParameters())+" on "+this+
final String username;
final Subject subject = SecurityUtils.getSubject();
if (subject != null) {
username = subject.getPrincipal() == null ? null : subject.getPrincipal().toString();
} else {
username = null;
}
logger.log(Level.WARNING, "GWT RPC Request "+request.getMethod()+
" by user "+username+
" with parameters "+Arrays.toString(request.getParameters())+" on "+this+
" took "+processingDuration+" to process, "+serializationDuration+" to serialize the response, so "+
totalDuration+" in total.");
}