Skip to content

LOG4J2-2882: Add support for JUL filters#381

Merged
rgoers merged 1 commit intoapache:masterfrom
ebourg:LOG4J2-2882
Jul 27, 2020
Merged

LOG4J2-2882: Add support for JUL filters#381
rgoers merged 1 commit intoapache:masterfrom
ebourg:LOG4J2-2882

Conversation

@ebourg
Copy link
Copy Markdown
Member

@ebourg ebourg commented Jul 2, 2020

This implements basic support for JUL filters as described in LOG4J2-2882. The log calls are delegated to the super class only when a filter is configured, I hope this preserves the performance in the general case. I left out the tracing methods because I wasn't sure delegating to the super class would generate a message with the right semantic.

@rgoers
Copy link
Copy Markdown
Member

rgoers commented Jul 4, 2020

Now that I look at this I find what was originally implemented rather odd. The setLevel() and setParent() methods throw exceptions and yet the setFilter method is still allowed. It seems to me if setFilter is supported then setLevel should be too (i.e. it would call setLevel on the underlying Log4j Logger). But if setLevel isn't supported then I don't understand why setFilter would be. In any case, I wouldn't have setLevel throw an exception. At most I would just ignore the call.

@ebourg
Copy link
Copy Markdown
Member Author

ebourg commented Jul 4, 2020

I agree that setLevel() shouldn't throw an exception. It could maybe just log a one time warning, but that's not worth breaking the application just because log4j was plugged in.

@rgoers rgoers merged commit 76e78ca into apache:master Jul 27, 2020
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

Successfully merging this pull request may close these issues.

2 participants