show authentication stacktrace only on trace log level

This commit is contained in:
Sebastian Sdorra
2012-08-29 18:09:09 +02:00
parent 08fe4b6eca
commit 230fd1a4fb
2 changed files with 18 additions and 1 deletions

View File

@@ -240,7 +240,15 @@ public class BasicAuthenticationFilter extends HttpFilter
}
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())

View File

@@ -150,6 +150,15 @@ public class AuthenticationResource
}
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);
}