-
Notifications
You must be signed in to change notification settings - Fork 463
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
[WFCORE-4336] Add the ability for a user to add custom filters for loggers and log handlers #3908
Conversation
FilterConfiguration configuration = logContextConfiguration.getFilterConfiguration(name); | ||
final String className = CLASS.resolveModelAttribute(context, model).asString(); | ||
final ModelNode moduleNameNode = MODULE.resolveModelAttribute(context, model); | ||
final String moduleName = moduleNameNode.isDefined() ? moduleNameNode.asString() : null; |
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.
No need to change this but in the future you can do
final String moduleName = MODULE.resolveModelAttribute(context, model).asStringOrNull();
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 saw that on a PR the other day and was quite surprised I didn't know about it :)
package org.jboss.as.logging.filters; | ||
|
||
import static org.jboss.as.logging.CommonAttributes.CLASS; | ||
import static org.jboss.as.logging.CommonAttributes.MODULE; |
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.
@jamezp While reviewing this I noticed the definitions of these is incorrect, at least for this use case and the other ones I could see. So I filed https://issues.jboss.org/projects/WFCORE/issues/WFCORE-4631. Not necessary to correct in this PR as it is a pre-existing issue.
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.
That seems correct. I'll get a fix for that probably today.
[WFCORE-4336] Add the ability for a user to add custom filters for loggers and log handlers.
JIRA: https://issues.jboss.org/browse/WFCORE-4336
Model Upgrade JIRA: https://issues.jboss.org/browse/WFCORE-4591
Feature JIRA: https://issues.jboss.org/browse/EAP7-1199
For testing with the subsystem tests I added some modules to the subsystem test resources. I'm not sure whether or not this was a good idea as these will require maintenance. However there is a potential to catch issues with unit tests which seems like a decent trade-off for now.
For the integration test I also add a module. I didn't see, or I'm unaware of, a standard way of doing this. If I missed that please let me know and I'll fix it.
I also went with using two attributes
constructor-properties
andproperties
for configuring the filter. I had consideredproperties
with a boolean to indicate whether or not this was a constructor property, however this seemed less user friendly as the stand key/value pair properties are already widely used and likely understood.