-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[Entitlements] Log message for troubleshooting if not entitled #122948
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
[Entitlements] Log message for troubleshooting if not entitled #122948
Conversation
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
rjernst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One suggestion
| private static void notEntitled(String message, Class<?> callerClass) { | ||
| // don't log self tests in EntitlementBootstrap | ||
| if (EntitlementBootstrap.class.equals(callerClass) == false) { | ||
| logger.warn(message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you construct the not entitled exception first then the exception can be logged, along with the stack trace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about doing it, but decided against it as we'd be logging the exception twice most of the time. I often find that more confusing / disturbing than being helpful in rare cases. On the other hand, obviously, those warnings are a lot more noticeable if there's a stacktrace attached.
I don't have a strong preference, happy to follow the crowed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel strongly in this case. The message is likely to have enough info to determine the remedy already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, not a strong preference. OK to leave it as-is -- like you said, this is mainly for when we have code that catches Throwable or similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 added
…ic#122948) Log message for troubleshooting if not entitled.
…ic#122948) Log message for troubleshooting if not entitled.
…ic#122948) Log message for troubleshooting if not entitled.
…) (#122961) Log message for troubleshooting if not entitled.
…) (#122963) Log message for troubleshooting if not entitled.
…) (#122962) Log message for troubleshooting if not entitled.
Log message for troubleshooting if not entitled.