如何在SocketAppender中使用模式布局 [英] How to use Pattern layout with SocketAppender

查看:66
本文介绍了如何在SocketAppender中使用模式布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了org.apache.log4j.net.SocketAppender不使用布局. 但是,我确实需要格式化日志,并且需要使用ConversionPattern. 有人知道吗?我必须使用某种SocketAppender.

I read org.apache.log4j.net.SocketAppender does not use a Layout. But, I really need to format my logs and I need to use a ConversionPattern. Does anybody know an alternate to this? I have to use some kind of SocketAppender.

谢谢

推荐答案

通过SocketAppender发送的日志将被序列化,并且必须先对其进行反序列化,然后才能为其指定布局.在远程主机上,您可以访问所有相同的信息,并且应该能够指定打印日志的布局.因此区别仅在于您在另一侧指定了布局.

The logs sent through a SocketAppender are serialized and can't have a layout specified to it until it is deserialized. On the remote host you'll have access to all the same information and should be able to specify the layout that the logs are printed in. So the difference is only that you specify the layout on the other side.

这篇关于如何在SocketAppender中使用模式布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆