How to use Pattern layout with SocketAppender

2020-02-15 03:32发布

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.

Thanks

1条回答
戒情不戒烟
2楼-- · 2020-02-15 03:55

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.

查看更多
登录 后发表回答