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

[WFCORE-4336] Add the ability for a user to add custom filters for loggers and log handlers #3908

Merged
merged 2 commits into from
Aug 30, 2019

Conversation

jamezp
Copy link
Member

@jamezp jamezp commented Aug 20, 2019

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 and properties for configuring the filter. I had considered properties 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.

@wildfly-ci wildfly-ci added the deps-ok Dependencies have been checked, and there are no significant changes label Aug 20, 2019
@jamezp jamezp added the Feature This PR adds a new feature to WildFly label Aug 20, 2019
@bstansberry bstansberry added the missing-reqs This PR is missing external requirements before it can be merged label Aug 21, 2019
@bstansberry bstansberry removed the missing-reqs This PR is missing external requirements before it can be merged label Aug 30, 2019
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;
Copy link
Contributor

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();

Copy link
Member Author

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;
Copy link
Contributor

@bstansberry bstansberry Aug 30, 2019

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.

Copy link
Member Author

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.

@bstansberry bstansberry added the ready-for-merge This PR is ready to be merged and fulfills all requirements label Aug 30, 2019
jamezp added a commit to jamezp/wildfly-core that referenced this pull request Aug 30, 2019
[WFCORE-4336] Add the ability for a user to add custom filters for loggers and log handlers.
@jamezp jamezp mentioned this pull request Aug 30, 2019
@bstansberry bstansberry merged commit 817d5a1 into wildfly:master Aug 30, 2019
@jamezp jamezp deleted the WFCORE-4336 branch October 8, 2019 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deps-ok Dependencies have been checked, and there are no significant changes Feature This PR adds a new feature to WildFly ready-for-merge This PR is ready to be merged and fulfills all requirements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants