Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization of logging in the AnnotationUtils Utility Class #1897

Open
ilxqx opened this issue Apr 26, 2024 · 1 comment
Open

Optimization of logging in the AnnotationUtils Utility Class #1897

ilxqx opened this issue Apr 26, 2024 · 1 comment

Comments

@ilxqx
Copy link

ilxqx commented Apr 26, 2024

Below is a code snippet from the class com.blazebit.annotation.AnnotationUtils:

public final class AnnotationUtils {

    private static Class<? extends Annotation> stereotypeAnnotationClass;

    static {
        try {
            stereotypeAnnotationClass = (Class<? extends Annotation>) Class.forName("javax.enterprise.inject.Stereotype");
        } catch (ClassNotFoundException ex) {
            Logger log = Logger.getLogger(AnnotationUtils.class.getName());
            log.log(Level.WARNING, "Stereotype annotation can not be found, skipping annotation inheritance via stereotype.");
        }
    }

    private AnnotationUtils() {
    }

    // ... omitted
}

I think the log printed here should be changed to the info level. Warnings give people an unacceptable illusion, and I am a perfectionist who dislikes warnings in logs for no reason.

My development environment is SpringBoot3.2, using blaze-persistence version 1.6.11.

Obviously, by default, the class javax.enterprise.inject.Stereotype is not in the classpath. I believe that in most development scenarios, this class does not exist either, and it is not an important issue worth noting or triggering warning log.

Thank you, I hope my suggestions can be adopted🙏.

@ilxqx
Copy link
Author

ilxqx commented Apr 26, 2024

The SpringBoot startup log contains the following log entry:

2024-04-26T14:33:14.417 WARN  36347 [     main] <userinfo unavailable> c.blazebit.annotation.AnnotationUtils    : Stereotype annotation can not be found, skipping annotation inheritance via stereotype.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant