如何在filter-spec配置中使用多个substituteAll过滤器?

时间:2015-04-17 16:32:00

标签: logging jboss7.x

我需要能够在standalone.xml日志配置中使用多个substituteAll过滤器表达式,如下所示。

<periodic-rotating-file-handler name="FILE" autoflush="true">
            <filter-spec value="substituteAll(&quot;(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11})&quot;,&quot;xxxx-xxxx-xxxx-xx&quot;),substituteAll(&quot;(&lt;ccSecurityCode&gt;.*&lt;/ccSecurityCode&gt;)&quot;,&quot;&lt;ccSecurityCode&gt;xxx&lt;/ccSecurityCode&gt;&quot;)"/>
            <formatter>
                <pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss} - %5p:%X{sessionId} - %C{1}.%M:(%L) | %m%n"/>
            </formatter>
            <file relative-to="jboss.server.log.dir" path="website.log"/>
            <suffix value=".yyyy-MM-dd"/>
            <append value="true"/>
        </periodic-rotating-file-handler>

我们正在使用JBoss AS 7.2。有没有办法做到这一点?我所有尝试这样做的尝试都失败了。我尝试用逗号分隔它们(抛出IllegalArgumentException“过滤器表达式后的额外数据”),将它们添加到任何/所有;但没有任何作用。

1 个答案:

答案 0 :(得分:0)

您需要将其包装在all()过滤器中。由于substituteAll过滤器始终返回trueall()过滤器确保所有过滤器都返回应该有效的可记录值。