How to add an encoder for a socket application

I am using the appback socket application, and everything is fine, I can get the log from the socket.

My scenario: we have a distributed application, all the logs will be written to the log file of the log with SocketAppender. I just use the SimpleSocketServer provided in the log to get the log from all applications. And the logs can be retrieved and saved.

But the only problem is that no encoder can be added for the socket appender, and the log message will be formatted, possibly in some default format. But I have to save them in some format.

I can find a log like SimpleSocketServer and the log server will receive a serialized object ( ILoggingEvent ) and format the object itself.

But so I need to write too many codes. I think there should be one convenient way to add an encoder.

+4
source share
1 answer

I don't think you need to worry about the serialized version. You will get SocketAppender for various String clients.

Then, while you configure SimpleSocketServer to use the desired encoder in your configuration, all your messages must be in the correct format on disk.

+1
source

Source: https://habr.com/ru/post/1403578/


All Articles