Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Logging 在jboss 6日志记录中设置替换过滤器_Logging_Jboss6.x - Fatal编程技术网

Logging 在jboss 6日志记录中设置替换过滤器

Logging 在jboss 6日志记录中设置替换过滤器,logging,jboss6.x,Logging,Jboss6.x,我想替换日志中的一些子字符串。使用JBoss6,它有自己的专有日志记录 例如: <password>myoutstandingpassword</password> myoutstandingpassword 到 xxxxxxxxxxxxxxxxxx 就目前而言,我可以使用jboss-logging.xml中的过滤器在日志中过滤这样的行 <filter> <not><match pattern="password"/></n

我想替换日志中的一些子字符串。使用JBoss6,它有自己的专有日志记录

例如:

<password>myoutstandingpassword</password>
myoutstandingpassword

xxxxxxxxxxxxxxxxxx
就目前而言,我可以使用jboss-logging.xml中的过滤器在日志中过滤这样的行

<filter>
<not><match pattern="password"/></not>
</filter>

此筛选器放置在日志处理程序中。这将完全删除该行

但是如何只删除一个子字符串我不知道。找不到文档。搜索源代码相当累人


注意:应该可以在JBOSS中使用Log4j作为6-。在Log4j中,可能可以进行替换。我喜欢在没有这些的情况下实现替换。

问题是我想过滤掉org.apache.cxf.interceptor.loggininterceptor记录的一些数据。在JBOSS AS 6中实现日志过滤是有问题的,所以最终的解决方案是使用我自己的定制LogginInterceptor并修改它

是这样做的:

我创建了一个扩展org.apache.cxf.interceptor.logginInterceptor的类

public class CXFLoggingInInterceptor extends LoggingInInterceptor {

    private String myCustomLogStringOperation(String logString) {

    ...

    }

    @Override
    protected String transform(String originalLogString) {
        return myCustomLogStringOperation(originalLogString);
    }

}
请注意重写的方法transform。在那里,您将对文本进行操作,然后将其记录下来

然后,我向完成日志记录的web服务添加了一个注释。注释是@OutInterceptors,它将替换默认的拦截器

CxFloggingInterceptor是我们在开始时定义的类

public class CXFLoggingInInterceptor extends LoggingInInterceptor {

    private String myCustomLogStringOperation(String logString) {

    ...

    }

    @Override
    protected String transform(String originalLogString) {
        return myCustomLogStringOperation(originalLogString);
    }

}
@WebService(
    name = ....
    endpointInterface = ....
)
@InInterceptors(interceptors = package.CXFLoggingInInterceptor)
@Stateless(name = ...)
@Remote(....)
@RemoteBinding(jndiBinding = ....)
public class MyClass implements MyClassInterface

....