generator-jhipster: Minor bug in LoggingAspect
Overview of the issue In the generated LoggingAspect class, the following method has a minor bug
@AfterThrowing(pointcut = "loggingPointcut()", throwing = "e")
public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
if (env.acceptsProfiles(Constants.SPRING_PROFILE_DEVELOPMENT)) {
log.error("Exception in {}.{}() with cause = {}", joinPoint.getSignature().getDeclaringTypeName(),
joinPoint.getSignature().getName(), e.getCause(), e);
} else {
log.error("Exception in {}.{}() with cause = {}", joinPoint.getSignature().getDeclaringTypeName(),
joinPoint.getSignature().getName(), e.getCause());
}
}
The log.error() method accepts 4 arguments in the if condition block but has only 3 {} placeholders in the format.
On a slightly related note: The log field on this class could be made static final
private static final Logger LOG = LoggerFactory.getLogger(LoggingAspect.class);
instead of
private final Logger log = LoggerFactory.getLogger(this.getClass());
Jhipster version 2.23.0
Reproduce the error Create a jhipster project normally. I don’t think there is a special scenario when this code is generated this way.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 15 (15 by maintainers)
@vivekmore then that’s another issue, please our guidelines say we should have only one issue per ticket