An application can run on multiple hosts and if we want to collect the logs from all clients we can use log4j's socket appender.
Log4j has implemented SimpleSocketServer which calls SocketNode which collects all events from all clients to a single log file so it's difficult to identify them.
Out goal is to collect events from each client to a separate log file with file name xxx-{client}.log where {client} is the client address.
This is implemented in https://github.com/zenglian/log4j-socket-server
The mainl logic is to add an appender for each SocketNode.
This will result in log files xxx-{client}.log, where {client} is the hostname or ip or the client.
-rw-r--r-- 1 leon dba 489884 May 26 2012 log4j-1.2.17.jar
-rw-r--r-- 1 leon dba746 Aug 5 20:33 log4j-server.properties
-rw-r--r-- 1 leon dba 5690 Aug 17 17:05 monitor-den01zur.example.com.log
-rw-r--r-- 1 leon dba 30741 Aug 17 17:05 monitor.log
-rw-r--r-- 1 leon dba 5946 Aug 17 17:04 monitor-slc10zhw.example.com.log
-rw-r--r-- 1 leon dba 5690 Aug 17 17:04 monitor-slc16ijn.example.com.log
-rw-r--r-- 1 leon dba 2838 Aug 17 17:05 monitor-slc16jeo.example.com.log
-rw-r--r-- 1 leon dba 8777 Aug 17 17:04 monitor-slc16ldq.example.com.log
-rwxr-xr-x 1 leon dba 5458 Aug 17 16:54 mylog4j.jar
-rwxr-xr-x 1 leon dba224 Aug 17 15:49 restart-log4j-server.sh
-rwxr-xr-x 1 leon dba 20 Aug 17 15:00 truncate-all.sh