("The method getLogger(String) is undefined for the type Logger") Minha classe do LoggerInterceptor não reconhece o método getLogger:
package br.com.alura.interceptor;
import br.com.alura.interceptor.Logger;
import javax.ejb.EJBException;
import javax.interceptor.*;
import javax.validation.ConstraintViolationException;
@Interceptor
@Logger
public class LoggerInterceptor {
@AroundInvoke
public Object treatException(InvocationContext context) throws Exception{
Logger logger = Logger.getLogger(context.getTarget().getClass().getName()); // DÁ ERRO NO MÉTODO getLogger
try {
return context.proceed();
} catch (Exception e) {
if (e.getCause() instanceof ConstraintViolationException) {
logger.info(e.getMessage());
} else {
logger.severe(e.getMessage());
}
throw e;
}
}
}
Classe Logger:
package br.com.alura.interceptor;
import java.lang.annotation.*;
import javax.interceptor.InterceptorBinding;
@InterceptorBinding
@Target({ElementType.TYPE,ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface Logger {
}