-
Bug
-
Resolution: Won't Do
-
Critical
-
None
-
7.1.0.ER2
-
None
On many places both in server and in components there is called on exception printStackTrace, this results in having the stacktrace printed to stderr. This results in each line of the stacktrace to be considered a new error message in logs.
Using stderr is
1) is inefficient from performance point of view and
2) it doesn't have such nice control of what and when should be printed (length of stacktrace,log level) as logging does.
I believe occurrences of using the printStackTrace in the code should be reviewed and either removed or replaced with logging where appropriate.
In the context of the undertow module, only the class XXX has a call to printStackTrace that seems unjustified:
@Override public AuthenticationMechanismOutcome authenticate(final HttpServerExchange exchange, final SecurityContext securityContext) { List<String> authHeaders = exchange.getRequestHeaders().get(AUTHORIZATION); if (authHeaders != null) { for (String current : authHeaders) { if (current.startsWith(DIGEST_PREFIX)) { String digestChallenge = current.substring(PREFIX_LENGTH); try { DigestContext context = new DigestContext(); Map<DigestAuthorizationToken, String> parsedHeader = parseHeader(digestChallenge); context.setMethod(exchange.getRequestMethod().toString()); context.setParsedHeader(parsedHeader); // Some form of Digest authentication is going to occur so get the DigestContext set on the exchange. exchange.putAttachment(DigestContext.ATTACHMENT_KEY, context); return handleDigestHeader(exchange, securityContext); } catch (Exception e) { e.printStackTrace(); } } // By this point we had a header we should have been able to verify but for some reason // it was not correctly structured. return AuthenticationMechanismOutcome.NOT_AUTHENTICATED; } } // No suitable header has been found in this request, return AuthenticationMechanismOutcome.NOT_ATTEMPTED; }
- clones
-
JBEAP-12220 There should be replaced stacktrace loggings to stderr with usage of logging.
- Resolved