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

LogListener: remove no-arg convenience methods #3202

Merged
merged 2 commits into from
Feb 21, 2025

Conversation

dsmiley
Copy link
Contributor

@dsmiley dsmiley commented Feb 20, 2025

These are hazardous/sloppy.  Tests should listen to a specific class/package.
@hossman
Copy link
Member

hossman commented Feb 20, 2025

Not really sure i understand why you consider them hazardous?

FWIW: The intent of these was to make it as easy as possible for folks to write tests asserting that "No code run in this block should cause any code, anywhere, to log an ERROR (WARN, etc...)" but see no great loss in making people write LogListener.error("") instead of LogListener.error()

@dsmiley
Copy link
Contributor Author

dsmiley commented Feb 20, 2025

For the hazard, see what I linked to. Houston agrees.

@madrob
Copy link
Contributor

madrob commented Feb 20, 2025

Maybe we remove the debug (and info?) no-arg versions, leave a comment why, and leave the warn and error versions around?

@hossman
Copy link
Member

hossman commented Feb 20, 2025

For the hazard, see what I linked to. Houston agrees.

Ah ok -- yeah, sorry i didn't notice that jira link.

The crux of the problem being that in order to listen to the logs at a particular level, we must enable the logs at that level, and enabling something like DEBUG at the ROOT level can really slow things down.

Totally valid point.

Maybe we remove the debug (and info?) no-arg versions, leave a comment why, and leave the warn and error versions around?

We could, but that functionality is still available by referring to the root level logger by "" (which is already mentioned as possible in the jdocs) for the rare case where it's useful ... I agree with David: we should "Make the common/safe thing easy, Make the rare/scary thing hard"

BTW David: skimming the code i see an out of date TODO that should also be removed..

  // TODO: no-arg factory variants that use "" -- simpler syntax for ROOT logger?

(don't want to leave a TODO suggesting someone re-add the thing you're removing)

Commit message:
Make the common/safe thing easy, Make the rare/hazardous thing hard
@dsmiley dsmiley merged commit 85b6847 into apache:main Feb 21, 2025
1 of 3 checks passed
@dsmiley dsmiley deleted the LogListener_remove_no-arg branch February 21, 2025 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants