Log calling user and groups separately in traces
Some users have many groups so that the log statement for the groups can get very large. If a log statement gets too large it may be dropped from the log (at least at Google). If that happens we know neither the calling user nor the groups. Split the log statement so that we are guaranteed to at least have the calling user in the trace. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: Ie9ce353ee2478df04c5c6e39cdb7b7d4050ce509
This commit is contained in:
@@ -328,10 +328,9 @@ public class RestApiServlet extends HttpServlet {
|
||||
logger.atFinest().log(
|
||||
"Received REST request: %s %s (parameters: %s)",
|
||||
req.getMethod(), req.getRequestURI(), getParameterNames(req));
|
||||
logger.atFinest().log("Calling user: %s", globals.currentUser.get().getLoggableName());
|
||||
logger.atFinest().log(
|
||||
"Calling user: %s (groups = %s)",
|
||||
globals.currentUser.get().getLoggableName(),
|
||||
globals.currentUser.get().getEffectiveGroups().getKnownGroups());
|
||||
"Groups: %s", globals.currentUser.get().getEffectiveGroups().getKnownGroups());
|
||||
|
||||
if (isCorsPreflight(req)) {
|
||||
doCorsPreflight(req, res);
|
||||
|
||||
@@ -585,9 +585,8 @@ class ReceiveCommits {
|
||||
// Process as many commands as possible, but may leave some commands in state NOT_ATTEMPTED.
|
||||
private void processCommandsUnsafe(
|
||||
Collection<ReceiveCommand> commands, MultiProgressMonitor progress) {
|
||||
logger.atFine().log(
|
||||
"Calling user: %s (groups = %s)",
|
||||
user.getLoggableName(), user.getEffectiveGroups().getKnownGroups());
|
||||
logger.atFine().log("Calling user: %s", user.getLoggableName());
|
||||
logger.atFine().log("Groups: %s", user.getEffectiveGroups().getKnownGroups());
|
||||
|
||||
if (!projectState.getProject().getState().permitsWrite()) {
|
||||
for (ReceiveCommand cmd : commands) {
|
||||
|
||||
@@ -134,9 +134,8 @@ class DefaultRefFilter {
|
||||
logger.atFinest().log(
|
||||
"Filter refs for repository %s by visibility (options = %s, refs = %s)",
|
||||
projectState.getNameKey(), opts, refs);
|
||||
logger.atFinest().log(
|
||||
"Calling user: %s (groups = %s)",
|
||||
user.getLoggableName(), user.getEffectiveGroups().getKnownGroups());
|
||||
logger.atFinest().log("Calling user: %s", user.getLoggableName());
|
||||
logger.atFinest().log("Groups: %s", user.getEffectiveGroups().getKnownGroups());
|
||||
logger.atFinest().log(
|
||||
"auth.skipFullRefEvaluationIfAllRefsAreVisible = %s",
|
||||
skipFullRefEvaluationIfAllRefsAreVisible);
|
||||
|
||||
Reference in New Issue
Block a user