Commits

Sebastian Sdorra committed 7e9fa6f

show authentication stacktrace only on trace log level

Comments (0)

Files changed (2)

scm-core/src/main/java/sonia/scm/web/filter/BasicAuthenticationFilter.java

         }
         catch (AuthenticationException ex)
         {
-          logger.warn("authentication failed", ex);
+          if (logger.isTraceEnabled())
+          {
+            logger.trace("authentication failed for user ".concat(username),
+              ex);
+          }
+          else if (logger.isWarnEnabled())
+          {
+            logger.warn("authentication failed for user {}", username);
+          }
         }
       }
       else if (logger.isWarnEnabled())

scm-webapp/src/main/java/sonia/scm/api/rest/resources/AuthenticationResource.java

     }
     catch (AuthenticationException ex)
     {
+      if (logger.isTraceEnabled())
+      {
+        logger.trace("authentication failed for user ".concat(username), ex);
+      }
+      else if (logger.isWarnEnabled())
+      {
+        logger.warn("authentication failed for user {}", username);
+      }
+
       throw new WebApplicationException(Response.Status.UNAUTHORIZED);
     }