Java Code Examples for org.jboss.logmanager.config.LogContextConfiguration#getFilterConfiguration()

The following examples show how to use org.jboss.logmanager.config.LogContextConfiguration#getFilterConfiguration() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FilterResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
protected boolean applyUpdate(final OperationContext context, final String attributeName, final String addressName, final ModelNode value, final LogContextConfiguration logContextConfiguration) throws OperationFailedException {
    final FilterConfiguration configuration = logContextConfiguration.getFilterConfiguration(addressName);
    String modelClass = CLASS.resolveModelAttribute(context, context.readResource(PathAddress.EMPTY_ADDRESS).getModel()).asString();
    if (PROPERTIES.getName().equals(attributeName) && configuration.getClassName().equals(modelClass)) {
        if (value.isDefined()) {
            for (Property property : value.asPropertyList()) {
                configuration.setPropertyValueString(property.getName(), property.getValue().asString());
            }
        } else {
            // Remove all current properties
            final List<String> names = configuration.getPropertyNames();
            for (String name : names) {
                configuration.removeProperty(name);
            }
        }
    }

    // Writing a class attribute or module will require the previous filter to be removed and a new filter
    // added. This also would require each logger or handler that has the filter assigned to reassign the
    // filter. The configuration API does not handle this so a reload will be required.
    return CLASS.getName().equals(attributeName) || MODULE.getName().equals(attributeName) ||
            CONSTRUCTOR_PROPERTIES.getName().equals(attributeName);
}
 
Example 2
Source File: FilterResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model, final LogContextConfiguration logContextConfiguration) throws OperationFailedException {
    final String name = context.getCurrentAddressValue();
    final FilterConfiguration configuration = logContextConfiguration.getFilterConfiguration(name);
    if (configuration == null) {
        throw LoggingLogger.ROOT_LOGGER.filterNotFound(name);
    }
    logContextConfiguration.removeFilterConfiguration(name);
}
 
Example 3
Source File: LoggingDeploymentResources.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
protected PropertyConfigurable getPropertyConfigurable(final LogContextConfiguration logContextConfiguration, final String name) {
    return logContextConfiguration.getFilterConfiguration(name);
}
 
Example 4
Source File: LoggingDeploymentResources.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
protected ObjectConfigurable getObjectConfigurable(final LogContextConfiguration logContextConfiguration, final String name) {
    return logContextConfiguration.getFilterConfiguration(name);
}